huafu / ember-google-map

An Ember addon to include a google-map Ember friendly component in your apps.
http://huafu.github.io/#/ember?name=ember-google-map
MIT License
87 stars 34 forks source link

Error: #collection: Could not find itemViewClass #9

Closed lionelrudaz closed 9 years ago

lionelrudaz commented 9 years ago

Hi,

First of all, thanks for your great work.

I tried to install your addon on my app, but I have the following error: #collection: Could not find itemViewClass

In a controller Availability, I set up the Google Maps attributes, I added the tag in the template, I don't know what can possibly be wrong.

I also noticed that you're using the deprecated form of each block. Do you plan to update?

Lastly, I encountered an issue the other day with another addon: is your addon compatible with Handlebars 2.0?

Here's the link to my repo: https://github.com/lionelrudaz/wellnow-frontend/tree/google-maps

Let me know if you need more information.

Cheers,

Lionel

huafu commented 9 years ago

I didn't try yet with handlebars 2.0. Also what dd you mean by deprecated form or each? I meant where do I use a deprecated form of it?

Lemme know for the each and as soon as I have a bit of time I'll check with hb2.0. I'll try to do it in less than a week.

lionelrudaz commented 9 years ago

About each deprecation error, I think that in your templates, instead of having this:

{{#each _markers itemView=markerViewClass}}
      <li>{{title}} @ {{lat}},{{lng}}</li>
      {{#if view.hasInfoWindow}}
        {{view 'google-map/info-window'}}
      {{/if}}
    {{/each}}

You should have this:

{{#each m in _markers itemView=markerViewClass}}
      <li>{{m.title}} @ {{m.lat}},{{m.lng}}</li>
      {{#if view.hasInfoWindow}}
        {{view 'google-map/info-window'}}
      {{/if}}
{{/each}}

More info here: http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope

I'm a newbie, so I'm not sure if this is correct.

Anyway, I don't know if the "#collection: Could not find itemViewClass" error is due to Handlebars 2.0.

Let me know if you need more information.

huafu commented 9 years ago

Ok, you're right with the each but that's easy to fix and is not the issue here.

As I said, I've never tested my addon with Handlebars 2.0. I'll first change the each to be sure they are not using deprecated form, and then investigate on the hb 2.0 issue.

Can you gimme the full stack of the error please? Or is your project standalone and I can clone it and test it right away?

cpttripzz commented 9 years ago

I am also having a similar problem:

Uncaught Error: Assertion Failed: You specified the itemView markerViewClass, but it was not found at undefined (and it was not registered in the container)

I am unable to import the MAP_TYPES as well with this:

import {MAP_TYPES} from 'ember-google-map/components/google-map';
 Ember             : 1.7.0 vendor.js:27675
 Ember Data        : 1.0.0-beta.10 vendor.js:27675
 Handlebars        : 1.3.0 vendor.js:27675
 jQuery            : 1.11.2 vendor.js:27675
 Ember Simple Auth : 0.6.7 

application.hbs:

{{google-map lat="100" lng="100" type="road" zoom="5"}}
huafu commented 9 years ago

@cpttripzz this is a different error, try to use a previous version of this addon, or upgrade your Ember to 1.8.1 (for the Uncaught Error: Assertion Failed: You specified the itemView markerViewClass, but it was not found at undefined (and it was not registered in the container).

For the MAP_TYPES, I have to update the readme, if you choose to update the version of Ember, then you have to import the MAP_TYPES from components/google-map relatively to your app (ie, from a controller like app/controllers/my-controller.js you'd import it with:

import { MAP_TYPES } from '../components/google-map';

Else if you choose to not update Ember and find a previous version of this component which does work, then the import might be working too.

This is due to a bug in pre 1.8.1 of Ember where the itemViewClass in each would not work as expected.

Also it looks like you don't need to import the MAP_TYPES as you do not seem to be using them in application.hbs

PS: I've allowed myself to update your comment so that it uses GFM for better reading

davidpaulsson commented 9 years ago

I also get this issue Uncaught Error: Assertion Failed: <xxxxxxx@component:google-map::ember344> #collection: Could not find itemViewClass with

Ember: 1.9.1
Ember Data: 1.0.0-beta.14.1
Handlebars: 2.0.0
jQuery: 2.1.3
davidpaulsson commented 9 years ago

Just confirmed that this doesn't work with the newest versions of Ember (1.9.1 and 2.0.0 of Handlebars). I cloned this repo, upgraded the project an get this error message

Uncaught Error: Assertion Failed: <dummy@component:google-map::ember259> #collection: Could not find itemViewClass 

As well as the deprecation notice discussed above.

huafu commented 9 years ago

Ok thanks a lot, I'm going to upgrade and see what needs to be fixed

davidpaulsson commented 9 years ago

@huafu awesome, looking forward to an update :) thank you for a great addon

huafu commented 9 years ago

Ok, version 0.0.14 published, can you try it out?

huafu commented 9 years ago

@davidpaulsson I fixed everything after upgrading to Ember 1.9.1 and handlebars 2.0.0, lemme know if everything works as expected ;-)

davidpaulsson commented 9 years ago

@huafu it's working now! awesome, i think it's safe to close this issue

huafu commented 9 years ago

Thanks!

lionelrudaz commented 9 years ago

Thanks I will test that ASAP.