gokatz
3/29/2017 - 7:03 AM

New Twiddle

New Twiddle

{
  "version": "0.12.1",
  "EmberENV": {
    "FEATURES": {}
  },
  "options": {
    "use_pods": false,
    "enable-testing": false
  },
  "dependencies": {
    "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
    "ember": "2.12.0",
    "ember-template-compiler": "2.12.0",
    "ember-testing": "2.12.0"
  },
  "addons": {
    "ember-data": "2.12.1"
  }
}
<h1>Welcome to {{appName}}</h1>
<button {{action 'testaction'}}>click</button>
<br>
{{my-comp}}
<br>
{{outlet}}
<br>
<br>
import Ember from 'ember';

export default Ember.Service.extend({
  testName: 'Myname'
});
import Ember from 'ember';

export default Ember.Mixin.create({
  appName: 'Ember Twiddle',
  myService: Ember.inject.service('my-service'),
  testing() {
    let testvar = this.get('myService').testName;
    console.log(testvar);
  }
});

import Ember from 'ember';
import TestFile from 'twiddle/file';

export default Ember.Controller.extend(TestFile, {
  appName: 'Ember Twiddle',
  actions: {
    testaction() {
			this.testing();
    }
  }
  
});
import Ember from 'ember';
import testMixin from 'twiddle/file';

export default Ember.Component.extend(testMixin, {
  getName: Ember.computed(function() {
		let name = this.get('myService').testName;
    console.log('GK', name);
    return 'gokul';
  })
});