Rerender view causes errors

181 views Asked by At

I'd like to change the layout of my page when I click anywhere in the page. Basically what I did, into my application view, I created a function that changes the layoutName, then rerender the view.

application.js (view)

export default Ember.View.extend({
    layoutName: 'application-layout1',
    click: function () {
        this.set('layoutName', 'application-layout2');
        this.rerender();
    }
});

application.hbs

{{outlet}}

application-layout1.hbs

Layout 1 header
{{yield}}
Layout 1 footer

application-layout2.hbs

Layout 2 header
{{yield}}
Layout 2 footer

It works fine, but I get some errors coming from Ember depending of the page I'm in.

From page 1, when I click, I get this:

Assertion Failed: Attempted to register a view with an id already in use: null

From page 2:

TypeError: Cannot read property 'parentNode' of null

Do you have any idea from where those errors are coming? Thanks

0

There are 0 answers