我有這樣的情況:如何添加一個HTML模板到div /指令點擊角js?
<somebutton></somebutton>
...
app.directive("somebutton", function(){
return {
restrict: "E",
scope: {
// not sure what i can do here
},
template: '<button ng-click="loadTemplate()" type="button">Text</button>',
link: function(scope, element){
scope.loadTemplate = function(){
//TODO: append "home.html" template inside body directive
}
}
}
});
...
<script type="text/ng-template" id="home.html">
<div>home</div>
</script>
...
<div body ></div>
這樣做可能會的其他途徑要有t他在HTML,而不是一個模板按鈕
<button ng-click="loadTemplate()" type="button">Text</button>
那麼也許有一個具有加載模板
但林不知道如何可以做到這一點的方法loadTemplate()
控制器。
混亂?是的:)
在這個問題上的任何想法?
感謝
我最近開始用角和肯定做的事情是正確的困惑......我喜歡考慮角度HTML被視爲模板,以便使用其他模板工具,角不知道......期待着一些答案...... – 2013-03-14 06:43:37