AngularJS : How do I switch views from a controller function?
In order to switch between different views, you could directly change the window.location (using the $location service!) in index.html file <div ng-controller=”Cntrl”> <div ng-click=”changeView(‘edit’)”> edit </div> <div ng-click=”changeView(‘preview’)”> preview </div> </div> Controller.js function Cntrl ($scope,$location) { $scope.changeView = function(view){ $location.path(view); // path not hash } } and configure the router to switch to different partials … Read more