您的位置:首页 > Web前端 > AngularJS

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

2016-03-26 10:59 627 查看
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);
});
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: