想动态的控制子模块加载的控制器
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. . .