Skip to content

Instantly share code, notes, and snippets.

@k-fish
Created November 8, 2016 20:19
Show Gist options
  • Save k-fish/088af9a6c8b272898a6c27fae0e96e8a to your computer and use it in GitHub Desktop.
Save k-fish/088af9a6c8b272898a6c27fae0e96e8a to your computer and use it in GitHub Desktop.
Glimmer2 Attrs changes
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
checkAttrs() {
alert(this.attrs.foo);
alert(this.attrs.bar);
alert(this.attrs.baz);
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
someAction() {
alert('cool');
}
}
});
<h1>Welcome to Glimmer2</h1>
<br>
{{example-component
foo=123
bar=(readonly 'meow')
baz=(action 'someAction')
}}
<br>
<h2>Component</h2>
<button onclick={{action 'checkAttrs'}}>Check Attrs</button>
<h3> Non attrs </h3>
{{foo}}<br />
{{bar}}<br />
{{baz}}<br />
<button onclick={{baz}}>Example Button</button>
<h3> Attrs </h3>
{{attrs.foo}}<br />
{{attrs.bar}}<br />
{{attrs.baz}}<br />
<button onclick={{attrs.baz}}>Example Button</button>
{
"version": "0.10.6",
"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.10.0-beta.2",
"ember-data": "2.9.0",
"ember-template-compiler": "beta",
"ember-testing": "beta"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment