0

I have directive with isolated scope and two-way data binding.

    app.directive('inputField', function() {
        return {
            restrict: 'E',
            require: '^ngModel',
            scope: {
                data: '=ngModel',
            },
            template: "<input type='text' ng-model='data' />",
        };
    });

If I put this directive to page. All works fine. Data in page scope and directive scope is equal.
But if I put directive in ng-repeat, directive not populate data to page scope.

How to resolve this problem?

Here's example of code.

John Slegers
  • 45,213
  • 22
  • 199
  • 169
ArsenyN
  • 13
  • 3

1 Answers1

0

check out the working plunker.

<div ng-repeat="d in data2">
    <input-field ng-model="data2[$index]"></input-field>     <br>
</div>

the issue was there because you are using ng-model without dot.

checked it using console.log. read this SO post.

Community
  • 1
  • 1
harishr
  • 17,807
  • 9
  • 78
  • 125
  • This (https://github.com/angular/angular.js/wiki/Understanding-Scopes) article explain bug reasons to me. Thanks for link and help. – ArsenyN Aug 25 '14 at 17:28