Question

Upon updating from angular 1.2.0-RC.2 to 1.2.0-RC.3 I noticed a breaking change triggered by changes to how ngBindHtmlDirective parses scope data (via this change). What I do is fetch a piece of SVG and then display it (SVG is valid and all that).

I have this bit of template markup:

<div ng-controller="MainCtrl">
  <div ng-bind-html="svg"></div>
</div>

And some logic on my app that requests the SVG from the server and then assigns it to $scope:

app.controller('MainCtrl', ['$scope', '$sce', 'API', function($scope, $sce, API) {
  API.getSVG().then( function(resp) {
    $scope.svg = $sce.trustAsHtml(resp.data.svg);
  });
}]);

This used to work on RC2 but doesn't anymore on RC3. Any idea what I'm doing wrong? thanks.

Was it helpful?

Solution

I set up a simple jsFiddle and it works fine with Angular 1.2.0-RC3 up to 1.2.4.

JS

$scope.svg = $sce.trustAsHtml('<svg xmlns="http://www.w3.org/2000/svg"><circle r="50"/></svg>');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top