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