this controller:
function testctrl ($scope, sharedproperties, $resource){ var userdataprofile = sharedproperties.getuserdataprofile(); var usercreatedboard = $resource('/boards?owner=:owner'); usercreatedboard.query({'owner':userdataprofile.id}, function (result) { console.log(result); }); } now problem sharedproperties.setuserdataprofile() called after calling 3rd party service , async. hence, when testctrl bound, userdataprofile null. how handle situation after sharedproperties.setuserdataprofile() called , variable has been assigned value 3rd party service, controller should bound?
i think want @ resolve:
http://www.youtube.com/watch?v=kr1qz8ik9g8
this allows load data before instantiating controller , firing routechangesuccess event.
in angular docs.
Comments
Post a Comment