I am encountering an issue with my Angular app where I am trying to insert HTML into the page using ngBindHtml, but it does not seem to be working. Take a look at my code below:
<main id="main" ng-bind-html="oreGen | trust"></main>
Here is my Angular app setup:
angular.module('programApp', ['programApp.controllers','programApp.filters','ngSanitize']);
angular.module('programApp.controllers', [])
.controller('programController', ['$scope', '$filter', function($scope, $filter){
$scope.oreGen = '<div class="oreFunction" ng-click="collectFunction(\'parenthesis\', 1)">test text</div>';
$scope.collectFunction = function(value1, value2){
alert(value1 + value2);
};
}]);
angular.module('programApp.filters', []).filter('trust', ['$sce', function($sce){
return function(text) {
return $sce.trustAsHtml(text);
};
}]);
Upon loading the page, nothing appears within the main element.
Here is the link to the Codepen for reference: http://codepen.io/trueScript/pen/MwbVpO?editors=101
It seems that the div being ngBinded does not display. Any insights on why this might be happening?