I have an issue with AngularJS. I have this code in my template to display a list of users:
<ion-list>
<ion-item class="item-avatar" ng-repeat="x in filtered = ( users | filter:query)" href="#/user/{{x.ID}}">
<img src="http://m.myapp2go.de/ionic/todo/www/img/ionic.png" />
<h2>{{x.Name1}}</h2>
<p>
{{x.Name2}} - ({{x.Phone}})
</p>
</ion-item>
</ion-list>
I get my data in a $http.get-request. JSON is unicoded, e.g.: "Name1":"• RS's •"
{"items":[{"ID":"10033","UserID":"RSC","Passwort":"66676e6567313233","Name1":"• RS's •","Name2":"Schumacher","NameZusatz":"RSC", ......
},
How can i display Name1 {{x.Name1}}
in the right way in my template?
In my controller i have a function which is decoding a string in the correct way using jquery.
$scope.decodeHTML = function(html_code) {
if (html_code) {
return $('<div />').html(html_code).text();
} else {
return '';
}
};
Do i have to change the $scope-data
with the converted string or are there other possibilities? I tried everything with ng-bind-html="expression"
but no success.
I have got the solution:
In my template :
That's it.