2
votes

i'm trying to add a view inside a template. this template defines a view called NewAssetLinkView. inside of it i'm adding TracksView. ember gives the exception :

Uncaught Error: assertion failed: an Ember.CollectionView's content must implement Ember.Array. You passed AssetLinksApp.NewAssetLinkController:ember538

it seems that the router is trying to automagically create NewAssetLinksController and apply it to TracksView, which is wrong. perhaps its doing this because TracksView is declared inside the NewAssetLinkView? (btw, NewAssetLinkController extends ObjectController)

i have a TracksController that TracksView should be using - how can i get the router to not try to automatically create and associate the wrong controller with TracksView?

<script type="text/x-handlebars" data-template-name="new_asset_link_view">
    .....
    {{view AssetLinksApp.TracksView}}
</script>
1
Try with controllerBinding in your TracksViewManoharan

1 Answers

5
votes

When you instantiate a view inside of a template the newly created view will be passed the controller of the view that created it. This is really useful because any view can access controller and does not need a binding to something like parentView.controller.

However, in your case you want to use a different controller. So you can pass in a controller binding with the {{view}} helper.

Try using

{{view AssetLinksApp.TracksView controller="AssetLinksApp.tracksController"}}