Reset a model with angular.js

前端 未结 7 983
一生所求
一生所求 2020-12-02 17:03

I\'m simply try to reset values like this :

$scope.initial = [
    {
        data1: 10,
        data2: 20
    }            
];


$scope.datas= $scope.initial         


        
7条回答
  •  遥遥无期
    2020-12-02 18:00

    Try changing the reset function to use angular.copy

    $scope.reset = function () {
        $scope.datas = angular.copy($scope.initial);
    };
    

提交回复
热议问题