Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. 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>
  2. @elwayman02 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>
  3. 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>
  4. @elwayman02 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"
    }
    }