Skip to content

Instantly share code, notes, and snippets.

@GavinJoyce
Last active February 9, 2016 16:34
Show Gist options
  • Save GavinJoyce/23c0f8a836d49b502cfa to your computer and use it in GitHub Desktop.
Save GavinJoyce/23c0f8a836d49b502cfa to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
enabled: false,
items: ['a'],
isNotEmpty: Ember.computed.notEmpty('items'),
actions: {
addItem: function() {
this.get('items').pushObject('another');
},
removeItem: function() {
this.get('items').removeAt(0);
}
}
});
<h1>inline if within concat bug</h1>
<h2 style="color: green">press the remove button</h2>
<button {{action 'addItem'}}>Add</button>
<button {{action 'removeItem'}}>Remove</button> items: {{items.length}}
<hr />
Has Items: [{{concat (if items 'T' 'F')}}] (array in concat)<br />
Has Items: [{{if items 'T' 'F'}}] (array simple)
<hr />
Has Items: [{{concat (if isNotEmpty 'T' 'F')}}] (boolean in concat)<br />
Has Items: [{{if isNotEmpty 'T' 'F'}}] (boolean simple)
{
"version": "0.5.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment