I'm trying to make a quick little data-grid directive with editing for a project. Here's the code sans directive.
HTML
<div> </div>
<div ng-app="app">
<div ng-controller="ctrl">
<table class=pure-table pure-table-striped>
<tr ng-repeat="row in data">
<td ng-repeat="col in row"><input ng-model="col"></td>
</tr>
</table>
<p>{{data}}</p>
</div>
</div>
JS
var app = angular.module('app', []);
app.controller('ctrl', function ($scope) {
$scope.data = [
[100, 200, 300],
[400, 500, 600]
];
});
CSS
td input { border: none; text-align: right; width: 5em; }
And the codepen: http://codepen.io/mikeward/pen/gwcjt
This "almost" works except the data model never gets updated even though I'm using two-way binding (it's behaving as one-way at the moment). Is this an Angular bug or am I just not understanding something?