i have condition in have input boxes in listing grid , have single directive, want send value directive ever input value is..up point working fine, when trying change value directive input box not updating list grid input box value directive set.
here working plnkr, let me know doing wrong.
http://plnkr.co/edit/dzdn4ittnccvsubejahr?p=preview
my controller
& directive
code -
var myapp = angular.module('myapp', []); myapp.controller('mainctrl', function(){ var vm = this; vm.fordirective = ''; vm.list = [ {id: "1", name: 'test 1', age: 35}, {id: "2", name: 'test 2', age: 36}, {id: "3", name: 'test 3', age: 37}, {id: "4", name: 'test 4', age: 38}, ]; }) myapp.directive('testdir', function(){ return { restrict: 'ea', scope: { directivevalue: "=" }, templateurl: 'dirtemplate.html', link: function(scope, elem, attrs) { } }; })
you set vm.fordirective
object reference item
:
then testdir
need know somehow field item
use model value. example, let's use helper attribute:
<testdir directivevalue="vm.fordirective" field="age">loading..</testdir>
and in directive template need bind directivevalue[field]
:
<input type="text" ng-model="directivevalue[field]" />