You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.
// Setting the app router and static folder
app.use(express.static(path.resolve('./public')));
// Globbing routing files
config.getGlobbedFiles('./app/routes/**/*.js').forEach(function(routePath) {
require(path.resolve(routePath))(app);
});
// For HTML5 Mode URL routing
app.all('/*', function(req, res, next) {
res.render('index');
});
The problem I have is that the site works fine if navigating URLs within it, however if I am logged in and manually enter the URL on the browser e.g. '/settings/profile' then it does not recognise that the user is logged in, however if I go back to the homepage '/' then it recognises the user is logged in.
Doing some debugging it seems the Authentication.user gets unset, however going back to the '/' something sets it again and it will only stay set if navigating via the site only and not entering URLs on the browser.
This code here on the 'Authentication' service:
_this._data = {
user: window.user
};
And this is on the layout.server.view.html (back-end template).
<script type="text/javascript">
var user = {{ user | json | safe }};
</script>
I guess it seems the above code in layour.server.view is not run due to the full page refresh, while having the hashbang mode, even if you type a URL in the browser, it does not cause a page refresh.
Surely it must be easier to use pretty URLs in HTML5 Mode without the above issues? I can not be the only one who wanted this?
Can anyone suggest what I could be doing wrong here and how I might be able to get it to work with HTML5Mode? I don't get this issue if using the default hashbang mode.
Hi Guys,
I have an issue where I have turned on HTML5Mode:
And also the Express re-write:
The problem I have is that the site works fine if navigating URLs within it, however if I am logged in and manually enter the URL on the browser e.g. '/settings/profile' then it does not recognise that the user is logged in, however if I go back to the homepage '/' then it recognises the user is logged in.
Doing some debugging it seems the Authentication.user gets unset, however going back to the '/' something sets it again and it will only stay set if navigating via the site only and not entering URLs on the browser.
This code here on the 'Authentication' service:
_this._data = {
user: window.user
};
And this is on the layout.server.view.html (back-end template).
I guess it seems the above code in layour.server.view is not run due to the full page refresh, while having the hashbang mode, even if you type a URL in the browser, it does not cause a page refresh.
Surely it must be easier to use pretty URLs in HTML5 Mode without the above issues? I can not be the only one who wanted this?
Can anyone suggest what I could be doing wrong here and how I might be able to get it to work with HTML5Mode? I don't get this issue if using the default hashbang mode.
See this SO question for more info:
http://stackoverflow.com/questions/26309107/angularjs-best-way-to-handle-state-on-manually-entered-urls
The text was updated successfully, but these errors were encountered: