I have a controller set to $ http.get before the scope of the request.
& lt; Mydir host = "'localhost How can I ensure that the required scope value is set before the controller was executed? : 8080' 'API =" / MyP / BLA =? Asdf = 123 "/>
is defined as ...
myapp.directive ('mydir', function () { Return {restrict: 'E', templateUrl: 'scripts /partials/dillist.html', link: function (region, element, ethers) {scope.host = attrs ['host']; scope.api = attrs ['API '];}}}); My service ..
.service (' MyService ', function ($ http, $ q) {return } {GetPageData: function (host, api)) {$ Http.get (host + API) /// some more stuff}}} giving the opportunity to assign properties to the director Before executing my controller service method, // MyService.getPageData ($ scope.host, $ scope.api) inside the
// controller. Then (function (res) {... some more code.}) ;
This is the easiest way to fix it with your existing architecture
Something like this:
$ radius. $ Watch ('[host, api]'), function () (if ($ scope.host & amp; $ Scope.api) MyService.getPageData ($ scope.host, $ scope.api) .then (function (res) {... some more code ..}); }, truth);
No comments:
Post a Comment