search

Home  >  Q&A  >  body text

angular.js - ionic1如何关闭页面

我做了一个表单,里面有保存和取消按钮
我如何才可以点击取消按钮将页面完全关闭呢,我不要使用$state.go或$ionicHistory.goBack()这种方法,
我要的效果是退出来就表单恢复原样的那种,请问ionic如何实现呢

给我你的怀抱给我你的怀抱2740 days ago639

reply all(1)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-15 17:14:32

    This has nothing to do with ionic

    If the data before modification of your form is obtained from the interface, you can re-query the interface and assign it to the Model

    If you want to reduce the pressure on the request interface, cache the original query value, such as

    $scope.model=resp.data;
    $scope.modelTmp=resp.data;
    

    Bind $scope.model on DOM
    Submit the data when you click save, and

    $scope.modelTmp=$scope.model
    

    Cancel directly

    $scope.model=$scope.modelTmp

    reply
    0
  • Cancelreply