Hi have started to develop an application using emberjs so far so good with everything, I have noticed one thing though, every now and again when I refresh the web page nothing is displayed, I get the following error in the browser console: Uncaught TypeError: Cannot read property 'layoutStates' of undefined -- ember-layout.js
If I refresh the page again the error goes away,
Why do I get this error? How can I stop this error from happening?
Thanks in advance...
route manager code as requested
App.routeManager = em.RouteManager.create({
rootView: App.main,
home: em.LayoutState.create({
selector: '.inbox',
viewClass: App.InboxView,
enter: function (stateManager, transition) {
this._super(stateManager, transition);
}
}),
View2: em.LayoutState.create({
route: 'contacts',
selector: '.contacts',
viewClass: App.ContactsView,
enter: function (stateManager, transition) {
this._super(stateManager, transition);
}
}),
View3: em.LayoutState.create({
route: 'account',
selector: '.account',
viewClass: App.AccountView,
enter: function (stateManager, transition) {
this._super(stateManager, transition);
}
})
});
Error happens line 126 of ember-layouts.js
init: function() {
// This is currently experimental. We allow
// the view itself to define it's substates
// for better encapsulation. To do this, set
// the layoutStates property.
var viewClass = get(this, 'viewClass');
if(viewClass) {
var layoutStates = get(viewClass, 'proto').layoutStates;
set(this, 'states', layoutStates);
}
this._super();
},