重置$ scope而不是刷新页面

时间:2015-02-02 22:39:02

标签: javascript angularjs

当页面加载时,$ scope是新鲜和干净的。我想存储新的状态,当用户单击重置按钮时,它会将$ scope重置为加载页面时的状态。下面的代码不起作用,但是与我想要发生的一致。如何存储原始$ scope,然后在$ scope更改后重置它?

(function () {
    //function that fires when button is clicked
    $scope.resetScope = function () {
        $scope = freshScope;
    }

    //$scope is stored on page load
    freshScope = $scope;
});

0 个答案:

没有答案
相关问题