Created
February 18, 2018 16:43
-
-
Save sheriffderek/9582b3fb1bacd111295654a34b54912e to your computer and use it in GitHub Desktop.
Welcome-like component
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.Component.extend({ | |
// It's key to understand that this is a | |
// "hash" of properties... | |
// and not a block for javascript (see click) | |
// Element | |
tagName: 'asisde', | |
classNames: ['example-component'], | |
// Attributes | |
greeting: 'Hey', | |
name: 'AshaM', | |
selected: false, | |
// Styles | |
classNameBindings: ['selected:fancy'], | |
click() { | |
var greeting = this.get('greeting'); | |
alert( greeting + '! you clicked me!'); | |
this.toggleProperty('selected'); | |
}, | |
}); |
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: 'Ember Twiddle' | |
}); |
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
.example-component { | |
display: block; | |
border: 1px solid gray; | |
border-radius: 10px; | |
padding: 10px; | |
margin-bottom: 20px; | |
} | |
.example-component h1 { | |
font-size: 20px; | |
margin: 0; | |
padding: 0; | |
} | |
.example-component.fancy { | |
background: lightgreen; | |
color: white; | |
} |
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