Ember.Select not working? - ember.js

I'm working off of sample code from http://emberjs.com/api/classes/Ember.Select.html and it doesn't appear to be working? I get this error:
Assertion failed: The value that #each loops over must be an Array. You passed names ember.js:394
Uncaught TypeError: Object names has no method 'addArrayObserver'
Here's my jsbin: http://jsbin.com/kogav/1/
Thanks for any help

Change it to
{{view Ember.Select contentBinding="names"}}
See http://jsbin.com/gocel/1/

Related

I can't get parent in child component

I am new in ember js. And I am trying to repeat this
http://discuss.emberjs.com/t/how-to-communicate-to-child-components/7772/7
{{#my-super-form as |parent|}}
{{some-child notify=parent}}
{{/my-super-form}}
And I always get
Uncaught TypeError: this.get(...).send is not a function
in
this.get('notify').send('somethingHappened');
Why?..
I use ember 1.12
And where can I read about params in yield, for example
{{yield param1 param2}}
I have found all answers here
http://emberjs.com/blog/2015/02/07/ember-1-10-0-released.html
in my my-super-form.hbs need to use
{{yield this}}

Error message about #each looping over a non array when it is already an array

I have updated to ember-cli#0.2.3 and am getting the following error message when running ember serve on an addon project of mine to start the dummy app.
Uncaught Error: Assertion Failed: The value that #each loops over must be an Array. You passed [search,create,read,update,delete]
controller has:
operations : ['search', 'create', 'read', 'update', 'delete'],
template.hbs has:
{{view "select" content=operations value=selectedOperation class="form-control"}}
The other thing I have noticed is that it appears EXTEND_PROTOTYPES is turned off by default or something because I have to change my .property() values to 'Ember.computed` instead.
This is caused because prototypes are turned off by default for addons. Ember's each helper expects an Ember array. Since prototype extenstions are turned off you will need to manually wrap an array in Em.A
operations : Em.A(['search', 'create', 'read', 'update', 'delete']),
This blog post from dockyard will be helpful on updating addons.

Extending a Select in Ember 1.8

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?
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.
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.

Why does EmberJS throws out an error when I use {{#link-to 'index'}}?

When I have a link in my template to index using the link-to helper, like so: {{#link-to 'index'}}Home{{/link-to}}, exactly as it's demonstrated on the documentation page here, I get the following error in the console and the application will not render:
Uncaught TypeError: Cannot call method 'lookup' of null

bindAttr calls error 'TypeError: elem is undefined' when collection of views rerendered

I'm using an Ember.CollectionView with an itemView that contains {{bindAttr class="App.offersController.filters.profile:selected"}}.
When App.offersController.filters changes, the collectionView rerender each itemView.
When I use {{bindAttr class="App.offersController.filters.profile:selected"}}, I receive error TypeError: elem is undefined on line 18675, Ember try to change attribute that was destroyed with old view.
In Ember's code i see comments:
If we can't find the element anymore, a parent template has been re-rendered and we've been nuked. Remove the observer.
It works when i use {{App.offersController.filters.profile}}, but not with {{bindAttr class="App.offersController.filters.profile:selected"}}
Update your ember.js into latest because there is an issue in ember.10.pre. Please refer here