angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

Interpolated attributes not working on comments

Open caiotoon opened this issue 13 years ago • 1 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}}.

caiotoon avatar Feb 05 '13 18:02 caiotoon

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!

btford avatar Aug 24 '13 00:08 btford