Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

templateURL in directive breaks interpolation in $observe #1941

@joshdmiller

Description

@joshdmiller

When using the templateUrl property, attrs.$observe will no longer interpolate values. See the following example (also in this plunker):

.directive( 'testDir', [ function () {
  return {
    restrict: 'A',
    scope: true,
    templateUrl: 'template.html',
    //template: "<span>{{testAttr}}</span>",
    link: function( scope, element, attrs ) {
      attrs.$observe( 'testDir', function ( val ) {
        console.log("attr changed to", val);
        scope.testAttr = val;
      });
    }
  };
}]);

This will work if either (a) template is used instead of templateUrl; or (b) an isolate scope with an '@' binding is used instead.

I cannot explain this behavior, so I am opening this issue. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions