码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2015-07-08 18:59:27      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:angularjs

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);
    });
});

版权声明:本文为博主原创文章,未经博主允许不得转载。

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

标签:angularjs

原文地址:http://blog.csdn.net/akemt/article/details/46805861

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!