angular.js
angular.js copied to clipboard
Interpolated attributes not working on comments
Not sure if this is a bug or a undocumented expected behavior. But when using attr.$observe() on comment restricted directives, it's not working as expected, returning always the __un__interpolated string value.
Here is a example, plunk here:
<div ng-app="app">
<span ng-controller="Test">
<!-- directive: test-dir {{val}} -->
<span ng-click="click()">{{ echo }}</span>
</span>
</div>
var app = angular.module("app", []);
function Test($scope) {
$scope.echo = 'silence';
$scope.click = function() {
$scope.val++;
}
$scope.val = 0;
}
app.directive('testDir', function() {
return {
restrict: 'M',
link: function(scope, el, attrs) {
attrs.$observe('testDir', function(value) {
scope.echo = value;
});
}
}
});
The span receiving {{ echo }} bind is always rendering the string {{val}}.
As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.
Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.
Thanks!