1

I have below code

code to render /result content whenever the defaultview function is called using the $route service

angular.module('myapp').controller
    ('ResultController',['$route',function ($route){ this.defaultview=function(){$routes._ _ _ _  ('/result');};}

What will be the value in last line dash area?Any suggestions?

3
  • i think this is usefull for you stackoverflow.com/questions/11907961/redirect-using-angularjs Commented Nov 16, 2016 at 6:48
  • might be It's $location.path('/result') Commented Nov 16, 2016 at 6:49
  • OP, are you using angular-ui-router? If not, please remove the tag Commented Nov 16, 2016 at 7:03

1 Answer 1

0

You need to use $location if you are using ngRouter. i.e.

In your case, you can use

$location.path('/result');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.