javascript - AngularJS remembering "old" scope values -


i have angularjs app user can select item list. taken screen contains select element contents based on selection first screen. select item select element , updates text fields on screen , works fine.

the problem have if go first screen , pick different item list, select element on 2nd page along text fields still have "old" item actively selected , text fields display "old" data.

how tell angular forget previous selections, no longer in scope? manually have reset fields when click "back"?

you need reset scope:

function todoctrl($scope) {     $scope.data = [         {text:'learn angular', done:true},         {text:'build angular app', done:false}     ];      $scope.orig = angular.copy($scope.data);      $scope.reset = function() {         $scope.data = angular.copy($scope.orig);     }; } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -