kraftwer1
kraftwer1

Reputation: 5751

How can I prevent (subclass of Ember._MetamorphView)?

According to this StackOverflow thread, using {{view}} within {{each}} is the right way to display a view for each element of an array (the thread is quite old, though).

Now my problem is that this method generates (subclass of Ember._MetamorphView) instead of (subclass of MyApp.MyView) and makes it impossible for me to call some specific methods later, defined in MyApp.MyView, it says:

Object <(subclass of Ember._MetamorphView):ember381> has no method 'play'

I know there are other ways to achieve the same goal, like {{collection}} or Ember.ContainerView, or even Ember.ArrayController. But if not really necessary, I really like to stay simple using the {{each}} approach.

Is there a way to prevent (subclass of Ember._MetamorphView) and have my own class?

Upvotes: 0

Views: 272

Answers (1)

kraftwer1
kraftwer1

Reputation: 5751

After hours of trying stuff out, I gave it up and did it using a collection:

{{#collection App.AnswersView contentBinding="answers"}}
  <div class="answer alpha">{{view.content.answer}}</div>
{{/collection}}

Upvotes: 2

Related Questions