As @BoxerBucks reports, reorganize your code into a link function and complete the link. You can also abandon the ng-init approach, since the link function is called when the directive is created.
Firstly, I changed the directive a bit, so the column name is in the value of the my-cell attribute (the lw object and $index are in scope, so there is no need to pass them)
<li ng-repeat="lw in lw_list" > <input my-cell="name" ng-class="'lib_name inline_div'" type='text' ng-model="lw.name" > <input my-cell="volume" ng-class="'number_field'" ng-model='lw.volume' /> </li>
The link function then registers this with the CellStore :
app.directive("myCell", function(CellStore){ return function(scope, elem, attrs) { CellStore.addCell(scope.lw, scope.$index, attrs.myCell); }; });
And finally, the addCell method:
app.service('CellStore', function() { this.addCell = function(lw, row, column) { console.log('add cell:', lw.name, row, column, lw[column]); }; });
http://jsfiddle.net/9Lmwj/2/
I was not exactly sure about your data structure, but I hope this is a good start.
source share