I have situation where the data in my angular controller is populated from a CMS. Some of this data includes urls that may contain accented characters as html entities (non-english language, é á etc.) This url data then bound to the href attribute of an anchor tag. However I cannot seem to get the data to bind without (I think) angular escaping the html. If I use ng-init to set the same url the binding works fine. This is not an option for my project though. The example (& JSFiddle) attached illustrates where the controller renders invalid links (I assume as a result of escaping) when binding data from the model but the value from ng-init renders correctly.
<body ng-app="myApp" ng-controller="myCtrl">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script>
<div>
<h1>Example from model json</h1>
<p>Link (href): <a href="{{item1.url}}">{{item1.url}}</a>
</p>
<p>Link (ng-href): <a ng-href="{{item1.url}}">{{item1.url}}</a>
</p>
</div>
<div>
<h1>Example from ng-init</h1>
<div ng-init="item2 = {'url':'http://www.example.com/file-áúó.pdf'}"></div>
<p>Link (href): <a href="{{item2.url}}">{{item2.url}}</a>
</p>
<p>Link (ng-href): <a ng-href="{{item2.url}}">{{item2.url}}</a>
</p>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', ['$scope',
function($scope) {
$scope.item1 = {
'url': 'http://www.example.com/file-áúó.pdf'
};
}
]);
</script>
</body>