Creating a list where one element must have a different template

Hello, I’m new to Ember.

I have a list of elements (ember model) where one element must be rendered using a different template. I’ve been reading through Ember’s documentation and believe that Creating a custom Ember.CollectionView is the way .

App.PendingListView = Ember.CollectionView.extend({
   createChildView: function(viewClass, attrs) {
       if (attrs.content.isConfirmed) {
           viewClass = App.FirstView;
       } else {
           viewClass = App.SecondView;
       return this._super(viewClass, attrs);

{{view 'pending-list'}}

I get my the content (model in the route) as follows.

App.PendingRoute = Ember.Route.extend({
    model: function() {

However, I don’t know how to pass this content to the CollectionView. My CollectionView renders nothing because content is null.

Check out the discourse search feature - it does exactly what you need

Thanks for your reply @Wayne_Douglas.

I checked out Discourse’s search, but I couldn’t figure out how the code is passing the content to the view: So, I continued searching on Google and found out this question on StackOverflow: ember.js - get content in view from ContentBinding - Stack Overflow

You can use contentBinding property {{view ‘pending-traders’ contentBinding=“controller”}}. In this case, using contentBinding=“Controller”, I could pass my content (model PendingList) to the CollectionView.

I didn’t find any reference to contentBinding or controllerBinding on Ember’s docs.