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.

Bindings from parent->child work differently for object #1056

@oliver-batchelor

Description

@oliver-batchelor

Using a transclude directive we have

  1. A binding to a value 'someVar'
  2. A binding to a value in an object 'data.someVar'

We have a textbox inside a transclude which is bound, and bind the value inside and outside the transclude for display.

In the first case we lose the binding between the two scopes as soon as we type text into the text box.

In the second case the binding is retained.

http://jsfiddle.net/Saulzar/pnSNj/12/

<wrap title="set someVar">
  <input type="text" ng-model="someVar">
  <p>Inside wrap: {{ someVar }} </p>
</wrap>
<p>Outside wrap: {{ someVar }}</p>   

C1 = function ($scope){
$scope.someVar = "Hello world";
$scope.data = {someVar: "Hello world"};
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions