Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • AngularJS Otherwise function

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 245
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: