The useAsDefault property on the HeroList Route Definition, indicates
that if no other Route Definition matches the URL, then this Route Definition should be
used by default.
but when I mark a route as useAsDefault and go to an invalid url hash-address, then nothing happens.
Steps to reproduce:
Download the component router demo app from plunker
Extract the zip file and start your favourite web server for the downloaded folder (e.g. php -S localhost:8080)
Edit app.js and change $locationProvider.html5Mode(false); to $locationProvider.html5Mode(true);. This is not strictly required, but this is what I did.
Go to localhost:8080. Result: You are correctly redirected to http://localhost:8080/#/crisis-center
Go to http://localhost:8080/#/heroes. Result: the Heroes component is correctly loaded.
Manually change the url to say: http://localhost:8080/#/foo-bar
Result:
Nothing happens. The url now says http://localhost:8080/#/foo-bar, but the application still shows the Heroes page.
Expected result:
Application redirects to the useAsDefault route, which is http://localhost:8080/#/crisis-center
Angular docs link say:
but when I mark a route as
useAsDefault
and go to an invalid url hash-address, then nothing happens.Steps to reproduce:
component router
demo app from plunkerphp -S localhost:8080
)app.js
and change$locationProvider.html5Mode(false);
to$locationProvider.html5Mode(true);
. This is not strictly required, but this is what I did.http://localhost:8080/#/crisis-center
http://localhost:8080/#/heroes
. Result: the Heroes component is correctly loaded.http://localhost:8080/#/foo-bar
Result: Nothing happens. The url now says
http://localhost:8080/#/foo-bar
, but the application still shows theHeroes
page.Expected result: Application redirects to the
useAsDefault
route, which ishttp://localhost:8080/#/crisis-center
More info: When I change this:
into this:
in
angular_1_router.js
, then it works. If I was to fix that properly though, I would putstraight after
. But I don't actually know, where the ts file for that source is.