我對angularjs非常陌生。 我想使用自定義的angularjs指令加載腳本標籤。下面是我想達到的示例代碼:使用自定義的angularjs指令加載腳本
angular.module('app')
.directive('myScript', function() {
return {
restrict: 'E',
template : function(e,a){
return '<script>document.write(5 + 6);</script>';
}
};
});
所以,當指令在HTML中加入11將顯示:
<div><my-script></myscript></div>
但我不能設法實現這一目標。所以,我猜我的代碼是錯的?請幫我解決一下這個。提前致謝。
下面..http問題的可能的複製://計算器.com/questions/27533421 /如何加載腳本使用自定義角度指示 – Vijay