Angularjs ng-controller with resolve

前端 未结 8 534
时光取名叫无心
时光取名叫无心 2021-02-01 20:30

I\'ve ran into problem with ng-controller and \'resolve\' functionality:

I have a controller that requires some dependency to be resolved before running, it works fine w

8条回答
  •  野的像风
    2021-02-01 21:12

    I was trying to solve the problem using ng-init but came across the following warnings on angularjs.org

    The only appropriate use of ngInit is for aliasing special properties of ngRepeat, as seen in the demo below. Besides this case, you should use controllers rather than ngInit to initialize values on a scope.

    So I started searching for something like ng-resolve and came across the following thread:

    https://github.com/angular/angular.js/issues/2092

    The above link consists of a demo fiddle that have ng-resolve like functionality. I think ng-resolve can become a feature in the future versions of angular 1.x. For now we can work around with the directive mentioned in the above link.

提交回复
热议问题