Skip to content

Instantly share code, notes, and snippets.

@miguelcobain
Created May 11, 2016 13:36
Show Gist options
  • Save miguelcobain/6265da0fd9a1252423b383d3e33ddaf3 to your computer and use it in GitHub Desktop.
Save miguelcobain/6265da0fd9a1252423b383d3e33ddaf3 to your computer and use it in GitHub Desktop.
link buttons
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'button',
attributeBindings: ['href', 'target'],
init() {
this._super(...arguments);
if (this.get('href')) {
this.set('tagName', 'a');
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{#my-component}}
button
{{/my-component}}
<br>
{{#my-component href="google.com"}}
button
{{/my-component}}
<br>
{
"version": "0.8.0",
"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.5.1",
"ember-data": "2.5.2",
"ember-template-compiler": "2.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment