簡単なangular.js
アプリケーションがあります。またindex.html
、私は自分のWebアプリケーションのフロントページとして持っています.今、私はそれを作成してディレクティブにfooter.html
含めたい.ng-include
index.html
私はルートコントローラを持っています:
function RootController ($scope) {
$scope.templates = [{name : 'footer.html', url : 'views/footer.html'}];
$scope.getFooter = function(){
return $scope.templates[0];
}
}
そして私のindex.html
テンプレート:
<div ng-controller="RootController" ng-include="getFoooter()">
....
</div>
footer.html
シンプルなhtmlがあります:<div>Test Test Test</div>
しかし、開いたときにindex.html
フッターが表示されません。なんで?どうすれば正しく含めることができますか?
UPD
問題が解決しました。多分誰かが私の解決策に役立つでしょう:
それはで動作します:
<div ng-controller="SkinController" data-ng-include data-src="getFooter()">
</div>
ありがとうございました。