Skip to content

Instantly share code, notes, and snippets.

@siva-sundar
Forked from gokatz/application.controller.js
Created February 19, 2016 06:17
Show Gist options
  • Save siva-sundar/44c9f1aefe413e8fc9c4 to your computer and use it in GitHub Desktop.
Save siva-sundar/44c9f1aefe413e8fc9c4 to your computer and use it in GitHub Desktop.
service inj
import Ember from 'ember';
import {mixin} from 'demo-app/apptest/mixin';
export default Ember.Controller.extend(mixin, {
appName: Ember.computed(function() {
return this.get('apptest.name');
}),
products: Ember.computed(function() {
return this.product;
})
});
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
return this.get('appname.product');
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<h3>Handling Projects Under </h3>
{{#each products as |product|}}
<li>{{product}}</li>
{{/each}}
<br>
{{outlet}}
<br>
<br>
import Ember from 'ember';
let mixin = Ember.Mixin.create({
product: ['mobile software', 'web development', 'wed design']
});
export mixin;
export default {
name: 'currentUser',
initialize: function(container, application) {
application.inject('controller', 'appname', 'service:appname');
//application.inject('controller', 'apptest', 'mixin:apptest');
application.inject('route', 'appname', 'service:appname');
}
};
export default Ember.Mixin.create({
product: ['mobile software', 'web development', 'wed design']
});
import Ember from 'ember';
export default Ember.Service.extend({
name: 'CodeX',
//product: ['mobile software', 'web development', 'wed design']
});
{
"version": "0.5.3",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "1.13.13",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.3.3/ember-data.js",
"ember-template-compiler": "1.13.13"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment