json - AngularJS Dynamic Editable Table Directive -


my goal here create dynamic editable table directive, takes in json object , outputs editable html table. here plunker of have far:

http://plnkr.co/edit/enay3g?p=preview

        ////////////////////////////////////         // save         ////////////////////////////////////         $scope.save = function (ind) {            $scope.headers.foreach(function(entry) {               $scope.data[ind][entry] = 0; //i know shouldn't 0, dont know how @ value of input text box           });              $scope.showing = false;         }; 

everything works, except save. dont know how update json object in controller of directive. , can't put ng-model on text boxes because overrides value being set json.

could possible add ng-model directive on "edition mode text boxes", "edition mode text boxes" should bind copy of row object instead of original 1 , later, on save operation replace original 1 edited copy

        ////////////////////////////////////         // showedit         ////////////////////////////////////         $scope.showedit = function (ind) {            // ...            $scope.edit = angular.copy($scope.data[ind]);            // ...          };           ////////////////////////////////////         // save         ////////////////////////////////////         $scope.save = function (ind) {            $scope.data[ind] = $scope.edit;            // ...         }; 

plunker: http://plnkr.co/edit/dllnve?p=preview


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -