-
Notifications
You must be signed in to change notification settings - Fork 28
Error with Ember master #17
Comments
I think, you are not using the router, aren't you? With the current implementation, you have to pass the application container to the view, which is something done automatically when using ember-routing.
I will figure out soon how this case can work easily. |
I am using the router. I think it may have something to do with using a ContainerView with a currentViewBinding, e.g: {{view Ember.ContainerView currentViewBinding="controller.myView"}} I'm using the latest Ember master to resolve an issue with currentViewBinding in RC3. If I remove my ContainerView with a currentViewBinding then ember-touch works. Sorry I can't be more help, but I'm unsure why/how currentViewBinding is causing the problem |
Also, if I pass the container to the controller.myView when I create it as you suggested, then ember-touch no longer throws an error. Graçias! |
My apologies, but I'm wrong (again). It isn't anything to do with a ContainerView and I don't have ember-touch working. So, to revert to my original comment, I am using the router - I've got a fairly standard Ember app - and I can't get ember-touch to work due to the error thrown in the original report. |
The exception is thrown because your view has not setup the container, loot at how the view is extended here. So,if you setup the container as I shown below or find any fix to setup the container on view creation, it must work. I thought the view was configured with the container in the view creation. Let me know, if you find a easy way to solve it. Anyway, I will take a look tomorrow using latest master, I think, maybe a last change has made the ember-touch setup not work anymore. |
I'll try and find a workaround, but I ran your integration tests against the master I have (before the move to Handlebars RC4 from yesterday) and they failed with the same error, so it looks like something has changed in how a container is setup for a view.
|
Thanks for the info. I will look at it soon and try to find a more convenient way to setup. Meanwhile, does your configuration work for your case? |
No, I can't get ember-touch to work at all with the latest ember master. See PR #18 for the changes to run the integration tests against the latest master. |
OK, having investigated it further I have a series of commits that get it to work for me within a real project. this.view.get('controller.container') In addition, I've altered the creation of the applicationGestureManager to happen in #willInsertElement of the Ember.View rather than #init, e.g: willInsertElement: function() {
this._super();
this._createGestureManager();
},
_createGestureManager: function() {
var eventManager = get(this, 'eventManager');
if (!eventManager) {
var applicationGestureManager = get(this, 'controller.container').lookup('gesture:application'); Doing the call in #willInsertElement means that we actually have a controller to get the container from. My changes are in PR #19 so you can review in more detail. |
Today i also stumpled upon this error:
I faced this problem too, when using ContainerViews. But i do not think that refering to the controller and usings its container is the right way to go. The answer to this problem is to let the framework handle the view creation. Before the fix my code looked like this: var cinemasView = App.CinemasView.create({
heading : heading
}); So did call create myself. But this not let Ember handle the creation and inject the needed container into the view. Instead i changed those lines to the following: var cinemasView = this.createChildView(App.CinemasView, {
heading : heading
}); The method above is provided by Ember.ContainerView. Using this method ensures that the property containerView is set on your new View. @mrship : I think this would be a better approach to your problem. From my perspective it looks awkward, that your controller is responsible for creating a view. This is actually the source of your problem, i think. You should move your logic concerning myView to your ContainerView and use createChildView. |
I'm trying to use ember-touch with the latest master and I'm getting the error
Uncaught TypeError: Cannot call method 'lookup' of undefined
which is coming from:Can you advise why this doesn't work with the latest Ember API?
The text was updated successfully, but these errors were encountered: