This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
//query: '', | |
clicked: false, | |
arr: Ember.computed('query', function() { | |
console.log('arr', this.get('query')); | |
let a = []; | |
if (this.get('query') !== undefined) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ember-runtime/lib/computed/reduce_computed_macros.js | |
// Credit to Nopik via https://github.com/emberjs/ember.js/pull/3503 | |
/* | |
var item1 = Ember.Object.create({ | |
tags: [ 'important', 'bug', 'task' ], | |
}); | |
var item2 = Ember.Object.create({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Adapter from "ember-data/adapters/json-api"; | |
export default Adapter.extend(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import computed from 'ember-macro-helpers/computed'; | |
import raw from 'ember-macro-helpers/raw'; | |
import { filterBy, first } from 'ember-awesome-macros/array'; | |
export default Ember.Controller.extend({ | |
data: [ | |
Ember.Object.create({ filter: 0, label: '1' }), | |
Ember.Object.create({ filter: 1, label: '2' }), | |
Ember.Object.create({ filter: 1, label: '3' }), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
actions: { | |
moveOn() { | |
return new Ember.RSVP.Promise((resolve, reject) => { | |
//should work with any async callback | |
setTimeout(resolve, 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
items: [ | |
{ id: 1, test: true, cat: 1}, | |
{ id: 2, test: true, cat: 2}, | |
{ id: 3, test: true, cat: 3}, | |
{ id: 4, test: true, cat: 4}, | |
{ id: 5, test: false, cat: 1}, | |
{ id: 6, test: false, cat: 2}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
import { Promise as EmberPromise } from 'rsvp'; | |
export default DS.Adapter.extend({ | |
deleteRecord() { | |
console.log('deleting', arguments); | |
return EmberPromise.resolve(); | |
}, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
let Container = Ember.Object.extend({ | |
init() { | |
this.set('items', []); | |
}, | |
comp2: Ember.computed('[email protected]', function() { | |
console.log('2deep'); | |
//console.log(this.items.mapBy('j')); | |
return Math.random(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Controller from '@ember/controller'; | |
import {action} from '@ember/object'; | |
import { inject as service } from '@ember/service'; | |
export default class ApplicationController extends Controller { | |
appName = 'Ember Twiddle'; | |
@service intl; | |
date = new Date(); |