Skip to content

Instantly share code, notes, and snippets.

@Robdel12
Last active January 17, 2017 21:34
Show Gist options
  • Save Robdel12/4f187baccb0b1de95a90bf5a9a3698a3 to your computer and use it in GitHub Desktop.
Save Robdel12/4f187baccb0b1de95a90bf5a9a3698a3 to your computer and use it in GitHub Desktop.
tagName-null
import Ember from 'ember';
export default Ember.Component.extend({
init: function() {
this._super.apply(this, arguments);
console.log(this.get('tagName'));
},
whatIsTheTagName: Ember.computed('tagName', function() {
let tagName = this.get('tagName');
if (tagName === null) {
return "null";
} else {
return this.get('tagName');
}
})
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
{{my-component}} {{! this is actually a div}}
{{my-component tagName="div"}}
{{my-component tagName=""}}
{{my-component tagName="span"}}
{{yield}}
<p>Your tag name is: {{whatIsTheTagName}}</p>
{
"version": "0.10.7",
"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",
"ember-data": "2.10.0",
"ember-template-compiler": "2.10.0",
"ember-testing": "2.10.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment