Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this.get('flashMessages') returns undefined. Pod structure? #71

Closed
codeithuman opened this issue Jun 17, 2015 · 7 comments
Closed

this.get('flashMessages') returns undefined. Pod structure? #71

codeithuman opened this issue Jun 17, 2015 · 7 comments

Comments

@codeithuman
Copy link

I'm trying to use ember-cli-flash with my application that is laid out in a pod structure. When calling this.get('flashMessage') from the controller, I get an error Uncaught TypeError: Cannot read property 'success' of undefined.

Do you know if the pod structure might cause conflict?

I will try to post an example of the error sometime tomorrow.

@thermokarst
Copy link

@ajrob27: I have an ember-cli 0.2.7 app set up with pods, and this add-on seems to work as advertised (thanks @poteto!!!). Two things come to mind though, first, in your example you are calling the wrong attribute, it should be this.get('flashMessages'), plural. Also, if you are using ember-cli and its built-in test server, I believe you need to cycle the server off and on for it to pick up the changes to the project configuration. Good luck!

@poteto poteto closed this as completed Jul 1, 2015
@Leooo
Copy link

Leooo commented Dec 17, 2015

I have the same issue, for some reason flashMessages is not injected into controllers (only see it in routes and views).

I thought there was a problem with injectionFactories and tried to inject the service into controllers through an initializer, but I still don't have any flashMessages property.

On Ember 1.12.1, Ember-cli 1.13.1, with pods

@Leooo
Copy link

Leooo commented Dec 17, 2015

Injecting the service into each controller which needs it with flashMessages: Ember.inject.service(), works well, strange..

@codeithuman
Copy link
Author

@Leooo, I'm been out of Ember for quite a while now, I'm not going to be any help 😞 Sorry!

@thermokarst
Copy link

@Leooo: Did you modify any of the configuration defaults? I just set up a test environment with Ember 1.12.1, ember-cli 1.13.1, and ember-cli-flash 1.3.8, using pods, and the flashMessages object is available in a podified controller, and works as expected. I mentioned to @ajrob27 earlier this summer that he was referencing flashMessage, instead of flashMessages --- just want to double-check that that isn't the case for your issue. Maybe you can provide a more concrete example of what your controller looks like? Thanks!

@Leooo
Copy link

Leooo commented Dec 17, 2015

Thanks for checking @thermokarst. I didn't change anything in the config yet. Yes, I'm using flashMessages not flashMessage. Honestly I have no clue where this can come from, I have a big app so this may be on my side somewhere. For now I'm happy with adding the service individually to controllers (and long term we will only be using components). I'll definitely let you know if I see where this comes from, just wrote in the issue in case someone else gets the same problem.

@gonvaled
Copy link

Don't forget to restart ember serve after installing ember-cli-flash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants