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

Can't get it to run at all #13

Closed
MerreM opened this issue Mar 6, 2017 · 4 comments
Closed

Can't get it to run at all #13

MerreM opened this issue Mar 6, 2017 · 4 comments

Comments

@MerreM
Copy link

MerreM commented Mar 6, 2017

No errors, just this.toast / self.toast undefined.

ember-cli: 2.11.1
node: 6.10.0
os: linux x64

@knownasilya
Copy link
Owner

Services are lazy, so you need to use get to use them.

var toast = this.get('toast');
// use toast

@NullVoxPopuli
Copy link

I have this problem, too. but this.get('toast') is undefined (I'm using module unification, though), not sure how much that would play in to things.

@knownasilya
Copy link
Owner

Sounds module unification related, since it's still pre alpha 👍

@NullVoxPopuli
Copy link

NullVoxPopuli commented May 2, 2018

sorta,
I did manage to get things working by having this for my resolver.js

import Resolver from 'ember-resolver/resolvers/fallback';
// import Resolver from 'ember-resolver/resolvers/glimmer-wrapper';

import { merge } from '@ember/polyfills';

import buildResolverConfig from 'ember-resolver/ember-config';
import config from '../config/environment';

let moduleConfig = buildResolverConfig(config.modulePrefix);
/*
 * If your application has custom types and collections, modify moduleConfig here
 * to add support for them.
 */

 merge(moduleConfig.types, {
  config: { definitiveCollection: 'main' },
  locale: { definitiveCollection: 'main'},
  'ember-i18n@config': { definitiveCollection: 'main' },
  'util': { definitiveCollection: 'utils' }
});

moduleConfig.collections.main.types.push('config');

export default Resolver.extend({
  config: moduleConfig
});

I have other stuff in here in an attempt to get ember-i18n working... but there is no hope of that atm.
the main thing for ember-toastr was the config: { definitiveCollection: 'main' }

both ember, and ember-resolver need to expose a config api so that addons can add to the config in a safe way (the existing way is kind of intimate / hacky.
see: emberjs/ember.js#16373

Ember addons need an API that allows them to alter the module unification config (for example https://github.com/ember-cli/ember-resolver/blob/master/mu-trees/addon/ember-config.js) and add their own collections and types. In theory Ember (or the resolver?) would use this same API to add its own types and collections.

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

3 participants