Saturday, 14 September 2013

How to delay instantion of a specific controller(not a route)?

How to delay instantion of a specific controller(not a route)?

I would like to have a directive which behaves as typical ng-controller,
but I want it to be called once a promise is resolved, not sooner. In HTML
this could be written like this:
<div ng-controller="myCtrl" ctrl-promise="p">
p could be any promise on parent scope. I know there is a way to delay
instantiation of a controller for a route(as answered here: Angular.js
delaying controller initialization), but I would much prefer to specify
this per controller rather than per route. I know I could use ng-if with p
as atribute, but is there other way?

No comments:

Post a Comment