# Creating a list where one element must have a different template

**URL:** <https://discuss.emberjs.com/t/creating-a-list-where-one-element-must-have-a-different-template/6604>\
**Category:** Uncategorized\
**Created:** [October 31, 2014, 5:21pm UTC](https://discuss.emberjs.com/t/creating-a-list-where-one-element-must-have-a-different-template/6604 "2014-10-31T17:21:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsangilve](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/jsangilve/32/10171_2.png) [@jsangilve](https://discuss.emberjs.com/u/jsangilve)\
**Post date:** [October 31, 2014, 5:21pm UTC](https://discuss.emberjs.com/t/creating-a-list-where-one-element-must-have-a-different-template/6604/1 "2014-10-31T17:21:43Z")

</div>

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);
    }   
});

```

* * *

```
//Template
{{view 'pending-list'}}

```

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

```
App.PendingRoute = Ember.Route.extend({
    model: function() {
        return this.store.find('pendingList');
    },                                                      
  }); 

```

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

---

<div class="post-metadata">

**Author:** ![Wayne\_Douglas](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/wayne_douglas/32/9568_2.png) [@Wayne\_Douglas](https://discuss.emberjs.com/u/Wayne_Douglas)\
**Post date:** [October 31, 2014, 6:16pm UTC](https://discuss.emberjs.com/t/creating-a-list-where-one-element-must-have-a-different-template/6604/2 "2014-10-31T18:16:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jsangilve](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/jsangilve/32/10171_2.png) [@jsangilve](https://discuss.emberjs.com/u/jsangilve)\
**Post date:** [November 3, 2014, 10:31am UTC](https://discuss.emberjs.com/t/creating-a-list-where-one-element-must-have-a-different-template/6604/3 "2014-11-03T10:31:46Z")

</div>

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: [https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/views/search-results-type.js.es6](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/views/search-results-type.js.es6). So, I continued searching on Google and found out this question on StackOverflow: [ember.js - get content in view from ContentBinding - Stack Overflow](http://stackoverflow.com/questions/12493693/get-content-in-view-from-contentbinding)

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.
