Angular js trigger routing
angularjs, javascript, routes
Solution
I have been using the so-called AngularJS way like this, at least the routing is handled by AngularJS rather than browser directly.
function Ctrl($scope, $location) {
$scope.resetApp = function(){
...
$location.url('/');
}
}
The path is what is defined in the `Route Provider` like this:
app.config(['$routeProvider', function ($routeProvider) {
$routeProvider.
when('/', {
templateUrl: 'index.html',
controller: 'Ctrl'
}).
...
Problem
I have a reset link, which is meant to reset my angular js app... ``` <a ng-click="resetApp()">reset</a> ``` I am handling the button press in the main controller... ``` $scope.resetApp = function(){ if(confirm("You will lose data...")){ $scope.user.reset(); // not sure how to do this in more angular js way window.location = "/#"; } } ``` I am not sure if setting the `window.location` as I have done is the right way to do things. It works for me, but does not seem like the correct way, and I have not been able to find out ow to do it online.