summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
authorARC <arjunrc@gmail.com>2015-04-26 12:35:55 -0400
committerARC <arjunrc@gmail.com>2015-04-26 12:35:55 -0400
commit190eba9f85e1dbabb8e537a7a044b7a2b70d201a (patch)
tree48c531bd2bc93023f5d472494cd14e6354f64b7d /www/js
parent4f85c93a83074f8a7a0dc754bd9516c51401c24e (diff)
fixed digest loop problem on initial app load - ui.route otherwise issue
Diffstat (limited to 'www/js')
-rw-r--r--www/js/app.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/www/js/app.js b/www/js/app.js
index a35abcd1..e72dd33a 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -169,10 +169,20 @@ angular.module('zmApp', [
// if none of the above states are matched, use this as the fallback
var defaultState = "/monitors";
+ //var defaultState = "/login";
// as it turns out I can't really inject a factory in config the normal way
// FIXME: In future, read up http://stackoverflow.com/questions/15937267/inject-service-in-app-config
//var defaultState = (ZMDataModel.isLoggedIn())? "/monitors":"/login";
- $urlRouterProvider.otherwise(defaultState);
+ //$urlRouterProvider.otherwise(defaultState);
+
+ // https://github.com/angular-ui/ui-router/issues/600
+ // If I start using the urlRouterProvider above and the
+ // first state is monitors it goes into a digest loop.
+
+ $urlRouterProvider.otherwise( function($injector, $location) {
+ var $state = $injector.get("$state");
+ $state.go("monitors");
+ });
});