Skip to content Skip to sidebar Skip to footer

Retrieve Inner Html Of Angularjs Directive Before Templateurl Overrides It

I have a directive I use for form validation boilerplate which I recently refactored. Allow me to explain the directive a little further before expanding. The directive usage: <

Solution 1:

To access the iniital html can use $transclude within directive controller. This is a slight change from earlier versions so assumes using 1.2

controller:function($scope,$transclude){
      $transclude(function(clone,scope){
        /* for demo am converting to html string*/$scope.buttons=angular.element('<div>').append(clone).html();
      });

    }

DEMO

Post a Comment for "Retrieve Inner Html Of Angularjs Directive Before Templateurl Overrides It"