-
-
Save NullVoxPopuli/606626d994fea18ae1cb to your computer and use it in GitHub Desktop.
Example of Attribute Binding
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 log from '../utils/log'; | |
import Post from '../models/post'; | |
export default Ember.Route.extend({ | |
model() { | |
return new Post({ | |
title: 'So Classy!', | |
author: 'Robert' | |
}); | |
}, | |
actions: { | |
error: function(error) { | |
log(error.message); | |
} | |
} | |
}); |
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
export default class Post { | |
constructor(options) { | |
for (let key in options) { | |
this[key] = options[key]; | |
} | |
} | |
} |
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.4.13", | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "canary", | |
"ember-template-compiler": "canary" | |
} | |
} |
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'; | |
Ember.onerror = function(error) { | |
log(error.stack); | |
}; | |
export default function log(...args) { | |
let msg = args.join(' '); | |
let logs = document.getElementById('logs'); | |
if (!logs) { | |
logs = document.createElement('pre'); | |
document.body.appendChild(logs); | |
} | |
logs.insertBefore( | |
document.createTextNode("\n" + msg), | |
logs.firstChild | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment