I've read most of the threads on using html5Mode and have ended up with a
confounding situation.
My current implementation WORKS in Google Chrome desktop, but does NOT work
in Firefox, Google Chrome mobile or Safari. Am using Angular 1.5
Behaviour:
- Site works. All links lead to non-hash URLs
- Refresh a URL or input the URL manually
- Shows page briefly (less 1/4 second)
- Redirects to index page instead of the input URL
- Behavior occurs on browsers noted but not Google Chrome
All browsers are latest release
I have:
1 Set rewrites on server (Firebase)
rewrites": [
{
"source": "**",
"destination": "/index.html"
}]
}
2 Implemented base href using "/" but also using "https://domain.com"
<meta name="viewport" content="width=device-width, initial-scale=1.0,
maximum-scale=1.0, user-scalable=no" />
<base href="/">
3 Implemented html5Mode(true):
$locationProvider.hashPrefix("!");
$locationProvider.html5Mode(true);
4. Set routes
.config (function config($routeProvider) {
console.log('go to purchase route provider');
$routeProvider.when('/purchase', {
templateUrl: 'sections/purchase/purchase.html',
controller: 'PurchaseCtrl'
});
})
CONSOLE LOG:
You can see that the intended controller DOES get called, but then it gets
knocked out to the main module which then redirects it to "/".
go to purchase route provider purchase.module.js:4:5 // Correct - this
is the intended route and controller
do we configure> app.module.js:31:6 // Incorrect, somehow the URL call has
sent the app back to app.module
Current state null app.module.js:33:6 // history.state showing as null
go to landing controller landing.module.js:19:3 // Sends it to the
controller at route"/"
Mystified.
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.