Angularjs bind HTML tags inside HTML tag
Consider the following code which is in my controller file,
$scope.update = "<div class='search'><input type="search" name="search" /></div>";
I want to bind this $scope.update
to a view inside another tag div
. Can this be done in angular.js
?
+3
Rajesh Kumar
source
to share
1 answer
Basically, you need to use the angular-sanatize library.
Add angular-sanatize.js to your html and in your module specify the dependency "ngSanitize"
And let's say, not
<div>{{update}}</div>
use
<div ng-bind-html="update"></div>
See " https://github.com/angular/bower-angular-sanitize " for details
+4
nikhilagw
source
to share