js
angular.module('starter.services', [])
.directive('loadScript', function() {
return {
restrict: 'EA',
terminal: true,
link: function(scope, element, attr) {
if (attr.ngSrc) {
var s = document.createElement('script');
s.src = attr.ngSrc;
document.body.appendChild(s);
}
}
};
})
html
<div load-Script ng-src="/jquery.js"></div>