Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View doesn't get its corresponding controller set

Tags:

ember.js

I am learning Ember and I have the following scenario... All views created using "outlets" properly get their controllers set by the framework. However I have a nested view embedded using {{view}} snippet. The view itself gets created but its controller doesn't get set. The view and controller share the proper naming convention and the framework should be able to associate them.

Why doesn't Ember associate controllers for views created with {{view}}? Looks like it does it for outlets only.

If this is by design then what is the reasoning behind it? What is the best practice to inject controllers for such views?

Thanks!

like image 236
Flexer Avatar asked Nov 19 '25 22:11

Flexer


1 Answers

Currently, the controller beeing set for this view is the controller of the parent view. For now you can perhaps manually set the controller you want with {{view App.YourView controllerBinding="App.yourViewController"}}.

That beeing said, you're right, Ember.js should probably do something neat buil-in. Maybe there is something scheduled for targetting this.

like image 173
sly7_7 Avatar answered Nov 22 '25 13:11

sly7_7



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!