angularjs - Access parent data model in directive -


i wrote directive check double values in data column:

the markup

<table>    <tr data-ng-repeat-start="rowitem in vm.model.data" ...>       <td>          <input type="text" data-ng-model="rowitem.id" data-unique-column="vm.model.data" />       </td>       ...    </tr> </table> 

and directive

(function () {     'use strict';      angular.module('app').directive('uniquecolumn', function () {         return {             restrict: 'a',             require: 'ngmodel',             link: function (scope, element, attrs, ngmodel) {                 element.on('keyup blur', function () {                      scope.$eval(attrs.uniquecolumn).foreach(function (item) {                         // validation logic                     });                 });             }         };     }); })(); 

everything works fine asked myself if there solution access data of repeater, i.e. vm.model.data, without passing argument directive?

because didn't isolate scope, can read javascript's prototypal inheritance. can perhaps access method child lookup parent's. , perhaps use $index parameter.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -