Last active
November 8, 2016 02:03
-
-
Save nightire/b7255a8cbf262bb6d4633a655df3a335 to your computer and use it in GitHub Desktop.
Binding Example 1
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 Route from 'ember-route'; | |
export default Route.extend({ | |
activate() { | |
document.body.classList.add('standard'); | |
} | |
}); |
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 Controller from 'ember-controller'; | |
import get from 'ember-metal/get'; | |
import set from 'ember-metal/set'; | |
export default Controller.extend({ | |
margin: {t: '0', r: '0', b: '0', l: '0'}, | |
actions: { | |
updateMargin(direction, {target: {value}}) { | |
set(this, `margin`, {...get(this, 'margin'), [direction]: value}); | |
} | |
} | |
}); |
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 Route from 'ember-route'; | |
export default Route.extend({ | |
}); |
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
*, *::before, &::after { | |
box-sizing: border-box; | |
} | |
strong { | |
color: red; | |
font-size: 1.2rem; | |
} |
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
{ | |
"version": "0.10.5", | |
"EmberENV": { | |
"FEATURES": {}, | |
"EXTEND_PROTOTYPES": true | |
}, | |
"options": { | |
"use_pods": true, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "//cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.js", | |
"hack": "//cdnjs.cloudflare.com/ajax/libs/hack/0.7.7/hack.css", | |
"standard": "//cdnjs.cloudflare.com/ajax/libs/hack/0.7.7/standard.css", | |
"ember": "2.9.0", | |
"ember-data": "2.9.0", | |
"ember-template-compiler": "2.9.0", | |
"ember-testing": "2.9.0" | |
}, | |
"addons": { | |
"ember-composable-helpers": "*", | |
"ember-route-action-helper": "*", | |
"ember-truth-helpers": "*" | |
} | |
} |
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 Component from 'ember-component'; | |
export default Component.extend({ | |
}); |
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 Component from 'ember-component'; | |
import computed from 'ember-computed'; | |
export default Component.extend({ | |
dimensions: computed('margin.{t,r,b,l}', function() { | |
const margin = this.get('margin'); | |
console.log(`changes detected by CP: `, margin); | |
return { | |
width: 800 - +margin.r - +margin.l, | |
height: 450 - +margin.t - +margin.b | |
} | |
}), | |
didReceiveAttrs() { | |
console.log(`changes detected by didReceiveAttrs: `, this.get('margin')); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment