javascript - AngularJS background update models - best practice -


i have script document , positions of document in interval in background. positions displayed ng-repeat, , field of positions aditable. when i'am writind new data position field, lost, becouse in apper new version of document , positions.

is posible check input/textares focused , merge data scope , new data?

my script:

$scope.getdoc = function (id) {     docfactory.get(id).then(function (doc) {          $scope.doc = doc;          posfactory.getpos(id).then(function (pos) {             $scope.pos = pos;         });      }); }  // when app start $scope.getdoc();  // when synced $rootscope.$on("synced",function(){     $scope.getdoc(); });  $scope.adddesc = function(pos, description) {     pos.description = description;     posfactory.getpos(pos.id, pos).then(function () {         $scope.getdoc();     }); }  <div ng-repeat="p in pos">     <form ng-init="description=p.desc">         <textarea ng-model="description"></textarea>         <input type="submit" value="save" class="btn btn-default"              ng-click="adddesc(p, description)">     </form> </div> 

try specify index in track by part of ng-repeat


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -