I have several blogs that are stored in my database. Some of them have javascript calculators inside the html like this one
<script type="text/javascript" src="http://www.financialsoccer.com/FinancialSoccer.js"></script>
I cannot get angular to parse the html and run the javascript.
So when it comes from the DB, it gets put into the scope value and looks something like this
$scope.article= '<h2> Financial Soccer</h2><script type="text/javascript" src="http://www.financialsoccer.com/FinancialSoccer.js"></script>'
I am already running it through $compile to compile any directives that may be in the blogs but the javascript wont execute.
.directive('dynamicElement', ['$compile', function ($compile) {
return {
restrict: 'E',
scope: {
article: "="
},
replace: true,
link: function (scope, element, attrs) {
var template = $compile(scope.article)(scope);
element.replaceWith(template);
}
}
}])
Is there a way to make this happen? Any help would be appreciated.
Thanks!