I am trying to use the ng-click feature of AngularJS to switch views. How would I go about doing this with the code below?
index.html
The provided answer is absolutely correct, but I wanted to expand for any future visitors who may want to do it a bit more dynamically -
In the view -
Go to edit
In the controller -
$scope.changeView = function(person){
var earl = '/editperson/' + person.id;
$location.path(earl);
}
Same basic concept as the accepted answer, just adding some dynamic content to it to improve a bit. If the accepted answer wants to add this I will delete my answer.
- 热议问题