84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
想动态的控制子模块加载的控制器
ng-controller="{{myCtrl}}"
但是这样会报错,系统提示myCtrl不是一个function。
应该是渲染的优先级问题,就是ng-controller渲染太快,后面的变量值还没来的及取到。
求大神指点下,这个要怎么办?
ringa_lee
Why do we need to add double brackets? If myCtrl是个正确controller, just remove the double brackets and write directly.
myCtrl
controller
Obviously angular parses the parameters of the ngController directive as strings, not expressions!
ng-controller="myCtrl" is fine. . .
Why do we need to add double brackets? If
myCtrl
是个正确controller
, just remove the double brackets and write directly.Obviously angular parses the parameters of the ngController directive as strings, not expressions!
ng-controller="myCtrl" is fine. . .