Trying to use ng-bind-html
to insert iframe into page with AngularJS & I can't get it to work it on even the simplest form.
Javascript
function Ctrl($scope) {
$scope.showIt = '<iframe src="http://www.anything.com"></iframe>';
}
My HTML:
<div ng-bind-html="showIt"></div>
You need to use $sce service to tell angular to render html content on view
Angular Doc says
Before doing it, you need to inject
ngSanitize
dependency inside your appYou can do it in two way either using
filter
orcontroller
HTML
JavaScript Code
From angular 1.2 onwards $sce feature is enabled for below version you should enable/disable it in config phase of angular.
Here is Working Fiddle