Assertion Fails while Rendering Multiple EmberJS Views

ember.js, javascript, view

Solution

You are overriding the init() method of Ember.View and not calling this._super(). This causes the view to not initialize properly resulting in your view elements missing id attributes (e.g. id="ember224").

Below is a link to your original JSBin with the addition of MyCustomView.init() calling this._super(). You will find the view elements now have id attributes.

http://jsbin.com/UHOh/11/edit?html,js,output

Problem

I am using the `view` helper multiple times, in order to render the same template but with different parameters every time, mostly booleans acting as option flags. However, I get the following error, whenever I render more than 1 of the same `view`: `Assertion failed: Attempted to register a view with an id already in use: null` My element tags do not have an "ember id", e.g. `id="ember224"`. I replicated the issue in a JSBin: Please note that in JSBin you won't be able to see the error logged in the console, for whatever reason. A simple copy and paste over to http://www.embersandbox.com/ and you can open up the console and see the error itself. http://jsbin.com/UHOh/1/edit?html,js,output Does anyone have any idea why this happens? If so, could it be a problem? Everything else is working as it should, for now, so I am inclined to ignore it. Thanks!

Original source