Reputation:
My existing code extends an Ember Select:
App.AreaSelect = Em.Select.extend(Em.TargetActionSupport, {
(...)
});
Using it like this in template:
{{view App.AreaSelect content=areas value=selectedArea}}
Now, apparently this way of doing it has changed in Ember 1.8:
"views are more appropriately resolved on the application via strings"
(whatever that means..?)
So, trying this in my template:
{{view "areaSelect" content=areas value=selectedArea}}
I just get the following error message:
"Uncaught Error: Assertion Failed: areaSelect must be a subclass of Ember.View, not "
(the last part is, as you can see, missing)
What am I doing wrong here?
Upvotes: 0
Views: 333
Reputation: 1
Since, you can't resolve a view on a global context from ember 1.8, you can register your view as a 'helper' and access it in template.
For your case try the following code.
...
Ember.Handlebars.helper('areaSelect', App.AreaSelect);
...
and in template code it like:
{{areaSelect content=areas value=selectedArea}}
I hope this might be helpful for you.
Upvotes: 0
Reputation: 692
The error you're getting is actually because it can't find a view named areaSelect.
Your naming convention for your select view is incorrect. It has to end with "View". If you rename it to App.AreaSelectView, it should resolve correctly.
App.AreaSelectView = Ember.Select.extend({
// blah
});
See JSBin for example.
Upvotes: 1