Ниже мой код:
app.controller('lookupMasterController', [
'$scope', '$routeParams', '$location', '$modal', 'lookupService', function ($scope, $routeParams, $location, $modal, lookupService) {
$scope.openCreatePopup = function() {
var modalInstance = $modal.open({
animation: true,
templateUrl: 'app/popups/add-lookup.html',
controller: function ($scope, $modalInstance, $location, $routeParams, lookupService) {
$scope.cancel = function() {
$modalInstance.close();
}
$scope.addLookup = function() {
$scope.lookup.lookUpConfigId = $routeParams.lookupMasterId;
lookupService.save($scope.lookup).$promise.then(
function (value) {
$location.path('/edit-lookup/' + $routeParams.lookupMasterId);
$scope.$apply();// Even this is not working.
// Tried the below as well:
//$scope.$apply(function() {
// $location.path('/edit-lookup/' + //$routeParams.lookupMasterId);
// });
$modalInstance.close();
},
function (error) { /*Do something with error*/
alert(error.message);
});
}
},
size: 'lg'
});
}
}
]);
Я открываю всплывающее окно для добавления нового поиска, а затем перезагрузить страницу, чтобы увидеть изменения. Но проблема в том, что: $location.path('url');
не работает.
использовать $ route.reload(), чтобы перезагрузить текущую страницу: http://stackoverflow.com/questions/16703215/how-to-reload-or-re-render -the-whole-page-using-angularjs – ThibaudL
Не работает также. –