I'm very new to angularjs. I want to load a script tag using a custom angularjs directive. Below is the example code for what I want to achieve:
angular.module('app')
.directive('myScript', function () {
return {
restrict: 'E',
template : function(e,a){
return '<script>document.write(5 + 6);</script>';
}
};
});
So, 11 will be displayed when the directive is added in html:
<div><my-script></myscript></div>
But I couldn't manage to achieve that. So, I guess my code is wrong? Please help me with this. Thanks in advance.