Main Javascript dont process in template loaded with directive in AngularJs -
i'm trying javascript function:
$(".panel-header .panel-toggle").click(function (event) { event.preventdefault(); $(this).toggleclass("closed").parents(".panel:first").find(".panel-content").slidetoggle(); });
to work on html i've loaded through directive
.directive('ngaddslide', function() { return { restrict:'e', scope: {'val': '@'}, templateurl:'template/portlet.html', } });
and compile in controler
var html = "<ngaddslide></ngaddslide>"; var target = $('#element'); target.append(html); html = $compile($('#element'))($scope)
the problem is, tho javascript works in original dom , template loads in page, js not apply new html.
is there way make javascript apply added html?
thx
Comments
Post a Comment