I'm using ui-router
Below is the code. I want main.list to be also called when I click on Save
or Delete button so that the list of items gets displayed again. What do I
add or modify to get it working?
from main.html
.
.
.
<a ui-sref="main.list" class="btn">Cancel</a>
<button ng-click="save()" ng-disabled="isClean() || myForm.$invalid"
class="btn btn-primary">Save</button>
<button ng-click="destroy()" ng-show="project._id" class="btn
btn-danger">Delete</button>
then in my app.js, I've tried different values in $location.path but
nothing seems to happen. I'm sure the PUT is working because I can see it
in the network tab of my chrome dev tools.
.
.
.
.state("main.list", {
url: "/list",
controller: ListCtrl,
templateUrl: 'list.html'
})
.
.
.
function EditCtrl($scope, $location, Restangular, project) {
var original = project;
$scope.project = Restangular.copy(original);
$scope.isClean = function() {
return angular.equals(original, $scope.project);
}
$scope.destroy = function() {
original.remove().then(function() {
$location.path('/list');
});
};
$scope.save = function() {
$scope.project.put().then(function() {
$location.path('/list');
});
};
}
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.