When $state.go("main.loadbalancer.readonly"); is activated in the resolve 
block, the main.loadbalancer.vips state controller VipListCtrl (the 
controller only) still loads after the resolve.

Since the state main.loadbalancer.readonly is activated, how can I keep 
make the controller VipListCtrl cancel and not load?

I tried using a promise and never having the promise resolve, but then the 
UI Router seems to stay sit at that resolve forever.


angular.module("main.loadbalancer", ["ui.bootstrap", "ui.router"]).config(
function($stateProvider) {
  return $stateProvider.state("main.loadbalancer", {
    url: "device/:id",
    views: {
      "content@": {
        templateUrl: "loadbalancer/loadbalancer.html",
        controller: "LoadBalancerCtrl"
      }
    }
  }).state("main.loadbalancer.vips", {
    resolve: {
        isDeviceReadOnly: function($state) {
        if (!$state.current.data['deviceId']) {
          $state.go("main.loadbalancer.readonly"); //THIS IS RAN...NEED 
CONTROLLER
                                                   //VipListCtrl TO NOT RUN 
AFTERWARDS
        }
      }
    },
    url: "/vips",
    templateUrl: "loadbalancer/vip-table.html",
    controller: "VipListCtrl"
  }).state("main.loadbalancer.nodes", {
    url: "/nodes",
    templateUrl: "loadbalancer/node-table.html",
    controller: "NodeListCtrl"
  }).state("main.loadbalancer.admin", {
    url: "/admin",
    templateUrl: "loadbalancer/admin.html",
    controller: "AdminCtrl"
  }).state("main.loadbalancer.readonly", {
    url: "/readonly",
    templateUrl: "loadbalancer/readonly.html",
    controller: "ReadonlyCtrl"
  });
});

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to