I'm trying to create a section of an application in Ember wherein there will be more than one outlet in a view and where each outlet will be connected to a collectionView. The problem seems to be that the second outlet becomes 'littered' with the variables of the first.
Now what I'm working on is more involved but: Here's a fiddle of the simplified issue.
There are 3 handlebars templates: The application
{{outlet dogs}}
{{outlet cats}}
Cats
Cat:{{view.content.name}}
Dogs
Dog:{{view.content.name}}
The outlets in the application templates are connected:
index:Em.Route.extend({
route:'/',
connectOutlets:function(router, context){
router.get('applicationController').connectOutlet('cats', 'catsCollection');
router.get('applicationController').connectOutlet('dogs', 'dogsCollection');
},
})
Then for both the cats and the dogs, I created an object to store the content:
App.Cats = Em.Object.create({
content:[{name:"Russian Blue"}, {name:"British Short Hair"}, {name:"Domestic Tabby"}]
});
A collection view:
App.CatsCollectionView = Em.CollectionView.extend({
content:App.Cats.content,
itemViewClass:'App.CatsView'
});
The view class for the collection view to render:
App.CatsView = Em.View.extend({
templateName:"cats",
init:function(){
}
});
But the result will show the content of the first outlet's collection repeated in the second:
Dog:Huski
Dog:Samoid
Dog:Elkhound
HuskiSamoidElkhound
Cat:Russian Blue
Cat:British Short Hair
Cat:Domestic Tabby
So how is this happening, and how can it be fixed?