angularjs开发常见问题-1(持续更新中...)

angularJs中学习中…
1.刷新当前页面数据:$state.reload

service.create(data).then(function (newItem) {
  flash.success = 'Successfully created something';
  service.fetchAll(var force = true).then(function (services) {
    $scope.services = services;
    $state.reload();
  });
});

2.新增保存之后,停留在刷新当前页面,而且清空数据:$state.go(‘.’, {}, { reload: true });

 WithdrawalsService.Create({
                    withdrawals: $scope.userList,
                    valueKeyList: $scope.arrayValueKey
                }).$promise.then(function (events) {
                            msgBoxUtils.bigBox(events);
                            //清空数据,刷新页面
                            $state.go('.', {}, { reload: true });
                            //保存成功,而且打印
                            Print(events); 
                    }, function (error) {
                        msgBoxUtils.bigBox(error);
                    });

3.延迟刷新当前页面:$timeout

service.create(data).then(function (newItem) {
  flash.success = 'Successfully created something';
  service.fetchAll(var force = true)
    .then(function (services) {
      $scope.services = services;
    }).then(function () {
      return $timeout(function () {
        $state.go('.', {}, { reload: true });
      }, 100);
    });
});
posted @ 2016-03-26 10:59  mfrbuaa  阅读(238)  评论(0编辑  收藏  举报