angularjs - Insert plain HTML into template -
i use angularjs 1.4 , need insert plain html receive $http.get() template html tags jquery inserts plain html dom tags.
conroller code:
var onloadurl = function( data ){ $scope.joomlacomponent = data; } joomlacomponent.loadurl( $location.absurl(), true ).then( onloadurl ); template:
<script type="text/ng-template" id="joomla-component.tpl"> <div class="uk-grid uk-margin-large"> {{joomlacomponent}} </div> </script> now insert plain text need have html tags inserted document's dom.
first off, need call $scope.$evalasync() in onloadurl function trigger digest cycle. then, use ng-bind-html="joomlacomponent" instead of {{ joomlacomponent }}.
Comments
Post a Comment