Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

[question] Rationale behind $router.navigate #239

Closed
cexbrayat opened this issue Apr 4, 2015 · 4 comments
Closed

[question] Rationale behind $router.navigate #239

cexbrayat opened this issue Apr 4, 2015 · 4 comments

Comments

@cexbrayat
Copy link
Member

I was wondering what the reasons are behind using a URL parameter in $router.navigate instead of a component name ?

To replace $location.path('/register'), I would have expect to write (maybe wrongly) :

$router.navigate('register');

instead of

$router.navigate('/register');

I was a bit surprised, as ng-link is working with component names.

To avoid remembering the URL, it's possible to do :

var url = $router.generate('register');
$router.navigate(url);

But that feels overkill... Am I missing something ? Or what are the reasons to use a url instead of a component name ?

@corbanbrook
Copy link

I agree, also using the component names would make it work like $state.go in ui-router as well.

@notrab
Copy link

notrab commented Apr 15, 2015

👍

@Simon-Li
Copy link

+1 expect answers as well.

@ocombes-oss
Copy link

+1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants