Answers for "angularjs class directive prepend"

0

angularjs class directive prepend

app.directive("otcDynamic", function($compile) {
     
    var template = "<button ng-click='doSomething()'>{{label}}</button>";
     
    return{
        link: function(scope, element){
            element.on("click", function() {
                scope.$apply(function() {
                    var content = $compile(template)(scope);
                    element.append(content);
               })
            });
        }
    }
});
Posted by: Guest on April-30-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language