Friday, 15 July 2011

angularjs - How to get element from angular model? -



angularjs - How to get element from angular model? -

so, have e.g. controller:

angular.module('example', []).controller('ctrl', function($scope) { $scope.data = '' // here, want know element property binded to.. });

and next markup:

<div ng-controller="ctrl"> ... <input type="text" ng-model="data" required> ... </div>

now how input-element within controller bind? in other words, how element binded on $scope.data?

the improve question trying do? in angular single element on scope binded multiple html elements through variety of mechanisms trying find influences difficult. on upside, it's not necessary.

one of major tenants of angular should update model , allow view take care of itself, is, it's okay view dependent on model, model should not dependent on view.

angularjs

No comments:

Post a Comment