I have an app that I build with ionic and angularjs, now after some tweaking and adding some stuff my dashboard cntrl has stopped working. Its like the angularjs is just nog working anymore on that page, all other pages in my app works fine, and angular expressions are being evaluated there. This is my controller thats not working anymore:
MyApp.controller('DashCntrl', function($scope, $stateParams, LoginService, User, $state) {
$scope.balance = "";
$scope.openTrades = "";
$scope.closedTrades = "";
User.getBalance().then(function(balance) {
$scope.balance = balance;
});
$scope.navigateTradingDesk = function() {
$state.go('app.tradingdesk');
};
$scope.navigateTrades = function() {
$state.go('app.trades');
};
$scope.navigateClosedTrades = function() {
$state.go('app.closed_trades');
};
User.getOpenTradeCount().then(function(openTradesCount) {
$scope.openTrades = openTradesCount;
})
User.getClosedTradesCount().then(function(closedTrades) {
$scope.closedTrades = closedTrades;
});
});
As far as I can see there is nothing wrong with this, I am not getting any errors or whatsoever. In my view I just get stuff like {{balance}} instead of an empty string or anything. Even if I do a {{1+2}} in my view it is not working.
What could be the problem?
This is my latest modification in the routing process, its to check the authentication before going to a state. As it seems, this is working.
.run(['$state', '$rootScope', 'LoginService',
function($state, $rootScope, LoginService) {
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
console.log(toState.name);
if (toState.name != "app.login" && toState.name != "app.logout") {
if (!LoginService.checkLogin()) {
event.preventDefault();
$state.go("app.login");
}
}
})
}
]);
Edit: here is my state part for the dashboard
.state('app.dashboard', {
url: "/dashboard",
views: {
'menuContent': {
templateUrl: "templates/dashboard.html",
controller: "DashCntrl"
}
}
})