Hi Readers,
Today, I will be discussing about the Otherwise Function available in $routeProvider in AngularJS. The main objective of this function is to redirect the end users to a particular route when the user by mistake or intentionally enters the wrong URL that is not available in route.
Following is the syntax for the otherwise function:-
$routeProvider.otherwise({redirectTo:'/view'});
Since, every AngularJS application has a fixed number of routes. Therefore, if somebody tries to mess around and enters wrong URL that doesn't exist in route (like http://......./view101) our application will not break and the user will be redirected to default mentioned location.
0 Comment(s)