HTML encoding problem
Need to find a way to decode HTML string to plain text.
HTML
<div ng-app ng-controller="LoginController">
<div class="title">Display Only...</div>
<hr />
<div>Name: {{ user.name }}</div>
<br />
<div>Address: {{ user.address }}</div>
<br />
<div>Escaped Sample: {{ sample }}</div>
<br /> <br /> <br />
<div class="title">Edit Form</div>
<hr />
Name: <input type="text" ng-model="user.name" ></input>
<br /><br />
Address: <input type="text" ng-model="user.address"></input>
<br /><br />
<p ng-bind-html="sample"></p>
</div>
CSS
input[type="text"] {
width: 300px;
}
.title {
font-weight:bold;
}
JavaScript
var myModule = angular.module('myModule', ['ngSanitize']);
//$sce.trustAsHtml('<span></span>')
function LoginController($scope, $sce) {
//This object is fected from a DB. The data is stored DB this way....
$scope.user = {
name: "Kenneth Hinsvark & Maurice McAlister",
address: "555555 W. Canyon Dr # B212"
};
$scope.sample = $sce.trustAsHtml('555555 W. Canyon Dr # B212');
}