Muli Yulzary Muli Yulzary - 1 year ago 63
Node.js Question

Some weird issue with template loading

I'm trying to implement HTML5 push state in my angular app but to no avail.

Things seem to work fine (I can access every static file from the browser by typing the exact path (an example would be

) but when I try to load template through
option in state definiton it's not loading anything. No errors in the console neither. Are my routes set up correctly?

Worth mentioning: when switching to
state I see
request in the server, but no request for the template.

Express routes:

app.use('/', express.static(__dirname + '/public'));
app.get('/[^\.]+$', function(req, res){
res.sendFile("index.html", { root: __dirname + '/public' });

App config:

function lazyLoad(pathjs) {
return ['$ocLazyLoad', function ($ocLazyLoad) {
return $ocLazyLoad.load(pathjs);

.state('home', {
url: '/',
template: 'Welcome home'
.state('profile', {
url: '/profile',
templateUrl: 'components/profile/profile.html',
controller: 'profileCtrl',
controllerAs: 'vm',
resolve: {
module: lazyLoad('components/profile/profile.js'),
user: ['SessionService', function (SessionService) {
return SessionService.currentUser();


Project tree:

Project tree

Answer Source

The issue was unresolved promise in the resolve clause.