angularjs - Compile angular directive dynamically -


if add angular material directive md-button :

angular.element( document.body ).append( '<md-button> material' ) 

it not recognize it's angular directive. question - how recompile scope/element

not sure if should doing this, right way use $compile function:

angular.element(document.body).append($compile('<md-button> material')($scope)) 

working plunker.


Comments