I'm attempting to iterate through data in a json file using Angular 1. One of the pieces of data contains HTML fieldsets and tabular data. Angular is stripping this out. How can I prevent this?
This is the code I am using for the app:
var app = angular.module( 'myApp', ['ngSanitize'] );
app.controller('crisisCtrl', function($scope, $http) {
$http.get("data.php").then(function(response) {
$scope.mkyData = response.data.records;
});
});
Json file (data.php):
{
"records": [
{
"Card": "3",
"Title": "Blah",
"Content": "<fieldset class=\"table bt-0\"><thead><tr><th>Name</th><th>Role</th><th>Number</th></tr></thead><tbody><tr><td>Bill</td><td> Director</td><td><a href=\"tel:000\">304 304-3042</a></td></tr><tr><td>Mary</td><td>Technical</td><td><a href=\"tel:000\">304 304-3042</a></td></tr><tr><td>Hannah</td><td>Engineer</td><td><a href=\"tel:000\">120 104-4042</a></td></tr></tbody></fielset>"
}
]
}
And within my html file:
<div class="container" ng-app="myApp" ng-controller="crisisCtrl">
<div class="card" ng-repeat="x in myData">
<div class="card-block" ng-bind-html="x.Content"></div>
</div>
</div>
Here's an adjusted fiddle: