Skip to content

Instantly share code, notes, and snippets.

@hergaiety
Last active June 1, 2016 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hergaiety/aa70c24d59d1c50efc885fbbd3aaccd2 to your computer and use it in GitHub Desktop.
Save hergaiety/aa70c24d59d1c50efc885fbbd3aaccd2 to your computer and use it in GitHub Desktop.
AnyBy / IsAny Comparison
import Ember from 'ember';
export default Ember.Controller.extend({
pets: Ember.computed(function() {
return ['dog', 'cat', 'fish'];
}),
checkAnyBy: Ember.computed('pets', function() {
console.log(this.get('pets').anyBy('cat'));
return this.get('pets').anyBy('cat');
}),
checkIsAny: Ember.computed('pets', function() {
console.log(this.get('pets').isAny('dog'));
return this.get('pets').isAny('dog');
})
});
{{#if checkAnyBy}}
AnyBy is True!
{{else}}
AnyBy is False!
{{/if}}
{{#if checkIsAny}}
IsAny is True!
{{else}}
IsAny is False!
{{/if}}
{
"version": "0.8.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "1.13.13",
"ember-data": "2.1.0",
"ember-template-compiler": "1.13.13"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment