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.

1.3.0-rc.1 - isolate scope @ bindings not kept up to date when used with the bindToController directive property #9052

Closed
@mragentman

Description

@mragentman

When using the bindToController directive property of Angular 1.3.0-rc.1, the isolate scope properties which are bound using the '@' are set properly upon initialization but not kept up to date with subsequent changes.

I have put together a Plunkr to demonstrate the issue. The two-way binding instance, using '=' in the isolate scope, receives updates as the radio button is changed but the binding with '@' does not:
http://plnkr.co/edit/cZcz70UlfPRrHZjDWcto?p=preview

Looking at the Angular source, it seems like the case statement for '@' may be keeping the wrong property up to date when the attribute changes (lines 6943-6953 in nodeLinkFn):

case '@':
    attrs.$observe(attrName, function(value) {
      isolateScope[scopeName] = value;
    });
    attrs.$$observers[attrName].$$scope = scope;
    if( attrs[attrName] ) {
      // If the attribute has been provided then we trigger an interpolation to ensure
      // the value is there for use in the link fn
      isolateBindingContext[scopeName] = $interpolate(attrs[attrName])(scope);
    }
    break;

It looks like the observe should be updating isolateBindingContext instead of isolateScope so that it keeps the controller instance property up to date instead of the scope property.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions