html - how to run javascript and css in a angular directive output? -
i have angular directive:
app.directive('templater', function() { return{ restrict: 'e', templateurl: '../../tmpl/themer.html', link: function(scope, element, attrs){ // execute metismenu plugin settimeout(function(){ $(element).templater(); }, 1); } } });
the intent push html themer.html main page.
right inside my_profile.html have tag <templater></templater>
.
now, html displays perfectly, css , js non-operational. css tags in template referenced directive affect , affected same js , css files associated parent document.
how tell directive enforce rules of parent file on inserted file?
thanks
use $timeout of angular instead of settimeout. inject $timeout dependency in directive
Comments
Post a Comment