Created
February 18, 2018 19:03
-
-
Save sheriffderek/d49bbf23b81aad1c8257f748d9edd44f to your computer and use it in GitHub Desktop.
shops and products / basic example
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: 'Shops to shop' | |
}); |
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 config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('shops', { path: '/' }, function() { | |
this.route('shop-list', { path: '/' }); | |
this.route('shop-detail', { path: ':shop_id' }); | |
}); | |
}); | |
export default Router; |
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'; | |
var tempShopData = [ | |
{ | |
id: 1, | |
name: 'Mystery barn', | |
products: [ | |
'Mysterious glasses', | |
'Mysterious eyebrows (2 sets)', | |
], | |
}, | |
{ | |
id: 2, | |
name: 'Body shop', | |
products: [ | |
'Left arm', | |
'Pair of feet', | |
'Ring finger', | |
], | |
}, | |
{ | |
id: 3, | |
name: 'Illness central', | |
products: [ | |
'Snot (2oz)', | |
'Flu virus', | |
'Coughs (20 pack)', | |
], | |
}, | |
]; | |
export default Ember.Route.extend({ | |
model() { | |
// takes data and assigns it | |
// to the 'model' attribute on the associated controller | |
return tempShopData; | |
}, | |
}); |
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.Route.extend({ | |
// model(incomingParameters) { | |
// return this.store.peekRecord('shop', incomingParameters.id); | |
// }, | |
}); |
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.Route.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
{ | |
"version": "0.13.0", | |
"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.16.2", | |
"ember-template-compiler": "2.16.2", | |
"ember-testing": "2.16.2" | |
}, | |
"addons": { | |
"ember-data": "2.16.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment