【发布时间】:2014-04-29 03:31:06
【问题描述】:
我的目标是访问父 $scope 变量。
这个post 对我有很大帮助,但是我不知道如何在真实案例中做到这一点。当我在子 html 中声明控制器时,它会引发错误:
areq?p0=ParentController&p1=not a function, got undefined
我的项目看起来像这样Plunker
是否因为嵌套的 App 声明而发生此错误?
【问题讨论】:
-
为什么要嵌套应用?
-
我不需要它。去掉了孩子的“ng-app”,错误依旧。
-
你需要在你的应用之前加载 Angular。所以,在你的 head 标签中切换两个脚本。
标签: javascript angularjs angularjs-ng-include