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);
});
});
本文转自mfrbuaa博客园博客,原文链接:http://www.cnblogs.com/mfrbuaa/p/5322399.html,如需转载请自行联系原作者