Skip to content

Instantly share code, notes, and snippets.

@buschtoens
Last active March 5, 2020 10:34
Show Gist options
  • Save buschtoens/32a30894211cab7760ab896fe0876d10 to your computer and use it in GitHub Desktop.
Save buschtoens/32a30894211cab7760ab896fe0876d10 to your computer and use it in GitHub Desktop.
No Service Base Class
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ApplicationController extends Controller {
@service foo;
}
export default class BarService {
hello = 'Hello World';
constructor(injections) {
Object.assign(this, injections);
}
static create(injections) {
return new this(injections);
}
}
import { inject as service } from '@ember/service';
export default class FooService {
@service bar;
constructor(injections) {
Object.assign(this, injections);
}
static create(injections) {
return new this(injections);
}
}
{{this.foo.bar.hello}}
{
"version": "0.16.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.14.3",
"ember-template-compiler": "3.14.3",
"ember-testing": "3.14.3"
},
"addons": {
"ember-data": "3.14.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment