Reputation: 247
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
in view inside another div
tag. Is it possible to do it in angular.js
?
Upvotes: 3
Views: 2827
Reputation: 28445
Basically, you need to use angular-sanatize library.
Add angular-sanatize.js in your html and in your module give a dependency of "ngSanitize"
And let us say rather than
<div>{{update}}</div>
use
<div ng-bind-html="update"></div>
For more details, please refer to "https://github.com/angular/bower-angular-sanitize"
Upvotes: 4