I'm new with Angular, and i am making an application with ionic. I can't show HTML from JSON in my view. I searched previous questions but still doesn't work. The html code is written as text..
My code
HTML
<div ng-bind-html="bindHTML"></div>
Json
"usuarios": [
{
"nombre": "Name 1",
"description":"<p>Some HTML</p><p>More HTML</p>",
"id": 0
},
{
"nombre": "Name 2",
"description":"<p>Some HTML</p><p>More HTML</p>",
"id": 1
}
]
Controller
.controller('UserCtrl', ['$scope', '$http', '$state', function($scope, $http, $state) {
$http.get('js/data.json')
.success(function(data){
$scope.data = data.usuarios[$state.params.id];
$scope.bindHTML = $sce.trustAsHtml(data.description);
});
}])
Thanks.