javascript - Resolve in router is not updating scope in time -
Hello there I have issue of tampering with scope variables (With resolution in router) before angular visual content renderer I am using AngularJS 1.2.16 I have where DIV is displayed on the basis of Scope Variable. I have a controller with scope variable This problem is usually working as a quote, when I use data injection from the router trough solution method. Let's say I have this router: This is also working , but it is too late When I try to wrap this setter inside the controller: It works .. But I want there is no desired delay. Is there an event, like sung or something else, where I can fire my setter? Or is IM doing all this wrong? :) Thank you I think you should start the data. Show value from the promise of the solution
& lt; div ng-hide = "data.show" & gt; & Lt; / Div & gt; Text to show;
$ scope.arived and seeing this variable, so when it will change, the function
toggleText ( )
$ scope.data.show will be set correctly / incorrect in the clock timer.
app.controller ('view1Controller', function ($ radius, arived) {$ Scope.arived = arived; // About this next paragraph $ Talking $ $ diameter . $ Watch ('arived', toggleText); Function toggle text (newVal, oldVal) {$ scope.data.show =! $ Scope to see base content;}});
$ routerprovider When ('/ view1' {Admin: "View 1 Controller", TemplateRail: "/templates/partial1.html", Solve: {arived: Function (DataService) {Return DataService Check ();}}});
dataService.check () is returning the promise and I
$ scope.arived in the controller
view1Controller
$ scope.arived is filled, but presented before the Angulale View That's why the text is not visible.
$ scope.arived = arived; In
$ timeout , fe. 1s delay
$ timeout (function () {$ scope.arived = arived;}, 1000);
app.controller ('view1Controller', function ($ radius, arived) {$ scope.arived = arived; // Talk about the next paragraph about this $ Is $ scope Data.show = arived; $ scope. $ Watch ('arived', toggle text); Function toggle text (newwall, oldwall) {$ scope.data.show =! $ Scope.data.show;}}) ;
Comments
Post a Comment