This file contains hidden or 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
| //This is in the appliation route: | |
| setupController:function(controller, model) { | |
| this._super(controller, model); | |
| controller.set('itemCollection', this.filterable(['ingredient', 'recipe'])); | |
| }, | |
| //This doesn't work | |
| filterable:function(types){ | |
| return this.store.find('item').then(function(collection){ |
This file contains hidden or 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
| filterable:function(types){ | |
| var promise = this.store.find('item').then(function(collection){ | |
| return collection.filter(function(item){ | |
| return types.contains(item.get('typeTag')); | |
| }); | |
| }); | |
| return DS.PromiseArray.create({promise:promise}); | |
| }, |
This file contains hidden or 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.$.ajax({ | |
| url: 'https://something.com/api', | |
| type: "POST", | |
| dataType: 'jsonp', | |
| jsonpCallback: 'handleResult', | |
| data: { | |
| "name": "Joe", | |
| "date": "2013/11/20" | |
| } | |
| }); |
This file contains hidden or 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
| var express = require('express'); | |
| var bodyParser = require('body-parser'); | |
| var globSync = require('glob').sync; | |
| var routes = globSync('./routes/*.js', { cwd: __dirname }).map(require); | |
| var httpProxy = require('http-proxy'); | |
| var apiProxy = httpProxy.createProxyServer(); | |
| module.exports = function(emberCLIMiddleware) { |
This file contains hidden or 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
| //Have tried using namespace or host | |
| export default DS.ActiveModelAdapter.extend({ | |
| // host: 'api', | |
| namespace: 'api', | |
| headers: { | |
| 'api_key': 'o8ah28ohoa29o9h', | |
| 'email': 'me@nowhere.com' | |
| } | |
| }); |
This file contains hidden or 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
| export default DS.RESTSerializer.extend({ | |
| serialize: function(plan, options) { | |
| var json = { | |
| "name": "testing1", | |
| "date": "2015/05/14", | |
| "distance_unit": "mi" | |
| } | |
| return json; | |
| } |
This file contains hidden or 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.Route.extend(SimpleAuth.AuthenticatedRouteMixin, { | |
| setupController:function(controller, model) { | |
| this.productStockCollection().then(function(collection){ | |
| controller.set('productStockCollection', collection); | |
| }); |
This file contains hidden or 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
| Router.map(function() { | |
| this.route('application'); | |
| this.route('protected'); | |
| this.route('login'); | |
| this.resource('clients', function(){ | |
| this.route('index', {path:'/'}); |
This file contains hidden or 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'; | |
| var attr = DS.attr, | |
| hasMany = DS.hasMany, | |
| belongsTo = DS.belongsTo; | |
| export default DS.Model.extend({ | |
| isVirgin:true, |
This file contains hidden or 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
| model:function(params){ | |
| return this.store.find('tvshow', params.anime_slug).then(function(result){ | |
| result.set('isVirgin', false); | |
| return result; | |
| }); | |
| } |