Skip to content

Instantly share code, notes, and snippets.

@elwayman02
Forked from rwjblue/components.my-component.js
Last active January 8, 2019 00:25
Show Gist options
  • Select an option

  • Save elwayman02/6b3433957d741aca97a71499df52b566 to your computer and use it in GitHub Desktop.

Select an option

Save elwayman02/6b3433957d741aca97a71499df52b566 to your computer and use it in GitHub Desktop.

Revisions

  1. elwayman02 revised this gist Jan 8, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions twiddle.json
    Original file line number Diff line number Diff line change
    @@ -9,9 +9,9 @@
    },
    "dependencies": {
    "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
    "ember": "3.2.2",
    "ember-template-compiler": "3.2.2",
    "ember-testing": "3.2.2"
    "ember": "3.1.4",
    "ember-template-compiler": "3.1.4",
    "ember-testing": "3.1.4"
    },
    "addons": {
    "ember-data": "3.4.2"
  2. elwayman02 revised this gist Jan 8, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions twiddle.json
    Original file line number Diff line number Diff line change
    @@ -9,9 +9,9 @@
    },
    "dependencies": {
    "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
    "ember": "3.1.4",
    "ember-template-compiler": "3.1.4",
    "ember-testing": "3.1.4"
    "ember": "3.2.2",
    "ember-template-compiler": "3.2.2",
    "ember-testing": "3.2.2"
    },
    "addons": {
    "ember-data": "3.4.2"
  3. elwayman02 revised this gist Jan 7, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion components.my-component.js
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ import Ember from 'ember';
    export default Ember.Component.extend({
    init() {
    this._super();
    this.set('bar', { });
    this.set('bar', {});
    this.set('keys', Object.keys(Ember.get(this, 'bar')));
    },

  4. elwayman02 revised this gist Jan 7, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion components.my-component.js
    Original file line number Diff line number Diff line change
    @@ -9,8 +9,8 @@ export default Ember.Component.extend({

    actions: {
    foo() {
    this.set('keys', Object.keys(Ember.get(this, 'bar')));
    this.setProperties({ 'bar.foo': undefined });
    this.set('keys', Object.keys(Ember.get(this, 'bar')));
    }
    }
    });
  5. elwayman02 revised this gist Jan 7, 2019. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion templates.components.my-component.hbs
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@
    <p>Current Value: {{bar.foo}}</p>
    <p>Random Value: {{bar.random}}</p>
    <p>Keys: {{keys}}</p>

    <button {{action 'foo'}}>Click Me</button>
  6. elwayman02 revised this gist Jan 7, 2019. 2 changed files with 4 additions and 4 deletions.
    2 changes: 1 addition & 1 deletion components.my-component.js
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ import Ember from 'ember';
    export default Ember.Component.extend({
    init() {
    this._super();
    this.set('bar', { foo: 'stuff' });
    this.set('bar', { });
    this.set('keys', Object.keys(Ember.get(this, 'bar')));
    },

    6 changes: 3 additions & 3 deletions twiddle.json
    Original file line number Diff line number Diff line change
    @@ -9,9 +9,9 @@
    },
    "dependencies": {
    "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
    "ember": "3.2.2",
    "ember-template-compiler": "3.2.2",
    "ember-testing": "3.2.2"
    "ember": "3.1.4",
    "ember-template-compiler": "3.1.4",
    "ember-testing": "3.1.4"
    },
    "addons": {
    "ember-data": "3.4.2"
  7. @rwjblue rwjblue revised this gist Jan 7, 2019. 2 changed files with 3 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions components.my-component.js
    Original file line number Diff line number Diff line change
    @@ -4,10 +4,12 @@ export default Ember.Component.extend({
    init() {
    this._super();
    this.set('bar', { foo: 'stuff' });
    this.set('keys', Object.keys(Ember.get(this, 'bar')));
    },

    actions: {
    foo() {
    this.set('keys', Object.keys(Ember.get(this, 'bar')));
    this.setProperties({ 'bar.foo': undefined });
    }
    }
    1 change: 1 addition & 0 deletions templates.components.my-component.hbs
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    <p>Current Value: {{bar.foo}}</p>
    <p>Random Value: {{bar.random}}</p>
    <p>Keys: {{keys}}</p>

    <button {{action 'foo'}}>Click Me</button>
  8. elwayman02 revised this gist Jan 7, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions templates.components.my-component.hbs
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    <p>Current Value: {{bar.foo}}</p>
    <p>Random Value: {{bar.random}}</p>

    <button {{action 'foo'}}>Click Me</button>
  9. @rwjblue rwjblue revised this gist Jan 7, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions templates.components.my-component.hbs
    Original file line number Diff line number Diff line change
    @@ -1 +1,3 @@
    <p>Current Value: {{bar.foo}}</p>

    <button {{action 'foo'}}>Click Me</button>
  10. elwayman02 created this gist Jan 7, 2019.
    14 changes: 14 additions & 0 deletions components.my-component.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    import Ember from 'ember';

    export default Ember.Component.extend({
    init() {
    this._super();
    this.set('bar', { foo: 'stuff' });
    },

    actions: {
    foo() {
    this.setProperties({ 'bar.foo': undefined });
    }
    }
    });
    5 changes: 5 additions & 0 deletions controllers.application.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    import Ember from 'ember';

    export default Ember.Controller.extend({
    appName: 'Ember Twiddle'
    });
    6 changes: 6 additions & 0 deletions templates.application.hbs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    <h1>Welcome to {{appName}}</h1>
    <br>
    <br>
    {{my-component}}
    <br>
    <br>
    1 change: 1 addition & 0 deletions templates.components.my-component.hbs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    <button {{action 'foo'}}>Click Me</button>
    19 changes: 19 additions & 0 deletions twiddle.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    {
    "version": "0.15.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.2.2",
    "ember-template-compiler": "3.2.2",
    "ember-testing": "3.2.2"
    },
    "addons": {
    "ember-data": "3.4.2"
    }
    }