Angular.js delaying controller initialization

后端 未结 3 1045
情深已故
情深已故 2020-12-03 05:28

I would like to delay the initialization of a controller until the necessary data has arrived from the server.

I found this solution for Angular 1.0.1: Delaying Angu

3条回答
  •  天命终不由人
    2020-12-03 06:16

    You could always just put "ng-show" on the outer-most DOM element and set it equal to the data you want to wait for.

    For the example listed on the Angular JS home page you can see how easy it is: http://plnkr.co/CQu8QB94Ra687IK6KgHn All that had to be done was That way the form won't show until that value has been set.

    Much more intuitive and less work this way.

提交回复
热议问题