Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ArrayProxy from 'ember-controller/proxy'
- import firebase from 'firebase'
- import _ from 'npm:lodash'
- export default ArrayProxy.extend({
- ref: null,
- init () {
- this.set('ref', firebase.database().ref('courses').limitToLast(10))
- return this
- },
- loadContent: function () {
- this.ref.on('value', snapshot => {
- const courses = _.map(snapshot.val(), (value, key) => {
- value.id = key
- return value
- })
- this.set('content', courses)
- })
- }.observes('ref')
- })
Add Comment
Please, Sign In to add comment