Last active
February 2, 2017 06:15
-
-
Save samselikoff/64c2043978da4760259f13a69bfa4495 to your computer and use it in GitHub Desktop.
Actions examples
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({ | |
showMessage() { | |
alert('You clicked me!'); | |
} | |
}); |
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({ | |
counter: 0, | |
incrementCounter() { | |
this.incrementProperty('counter'); | |
} | |
}); |
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({ | |
counter: 0, | |
init() { | |
// Bind our function so `this` is properly set | |
this.incrementCounter = this.incrementCounter.bind(this); | |
}, | |
incrementCounter() { | |
this.incrementProperty('counter'); | |
} | |
}); |
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({ | |
counter: 0, | |
incrementCounter() { | |
this.incrementProperty('counter'); | |
} | |
}); |
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({ | |
counter: 0, | |
actions: { | |
incrementCounter() { | |
this.incrementProperty('counter'); | |
} | |
} | |
}); |
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({ | |
counter: 0, | |
actions: { | |
incrementCounterBy(val) { | |
this.set('counter', this.get('counter') + val); | |
} | |
} | |
}); |
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({ | |
counter: 0, | |
actions: { | |
incrementCounterBy(val) { | |
this.set('counter', this.get('counter') + val); | |
} | |
} | |
}); |
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({ | |
counter: 0, | |
actions: { | |
incrementCounterBy(...args) { | |
let total = args.reduce((memo, el) => memo + el); | |
this.set('counter', this.get('counter') + total); | |
} | |
} | |
}); |
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('example-1'); | |
this.route('example-2'); | |
this.route('example-3'); | |
this.route('example-4'); | |
this.route('example-5'); | |
this.route('example-6'); | |
this.route('example-7'); | |
this.route('example-8'); | |
}); | |
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
body { | |
margin: 0; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
header { | |
background: #333; | |
color: white; | |
padding: 15px; | |
} | |
h1 { | |
text-align: center; | |
} | |
nav { | |
display: flex; | |
flex-direction: column; | |
} | |
nav a { | |
color: #999; | |
text-decoration: none; | |
margin: 5px 20px; | |
font-size: 18px; | |
} | |
nav a:hover, | |
nav a.active { | |
color: white; | |
} | |
nav small { | |
text-transform: uppercase; | |
font-size: 13px; | |
padding-right: 10px; | |
} | |
.padded { | |
padding: 30px; | |
} |
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.11.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.10.2", | |
"ember-data": "2.11.0", | |
"ember-template-compiler": "2.10.2", | |
"ember-testing": "2.10.2" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment