ng-include是否創建一個新的子範圍?ng-incude是否創建一個新的子範圍?
<html>
<body ng-app="mytodoApp">
<div class="container" ng-include="'views/main.html'" ng-controller="MainCtrl"></div>
</html>
ng-include是否創建一個新的子範圍?ng-incude是否創建一個新的子範圍?
<html>
<body ng-app="mytodoApp">
<div class="container" ng-include="'views/main.html'" ng-controller="MainCtrl"></div>
</html>
是的,從https://docs.angularjs.org/api/ng/directive/ngInclude:
此指令創建新的範圍。
如何獲取子範圍? – 2014-10-30 14:52:59
@SaiAvinash從哪裏? – sp00m 2014-10-30 14:53:35
@ sp00m ..你可以看看這個嗎? http://stackoverflow.com/questions/26654059/trouble-with-basic-todo-app-angular-js/26654181?noredirect=1#comment41914735_26654181 – 2014-10-30 14:58:31
你應該努力一下並閱讀[docs](https://docs.angularjs.org/api/ng/directive/ngInclude)。 – 2014-10-30 15:04:51