Skip to content

Instantly share code, notes, and snippets.

View phillipkregg's full-sized avatar
💭
Kick it!

Phil Lackey phillipkregg

💭
Kick it!
  • Nashville, TN
View GitHub Profile
@phillipkregg
phillipkregg / components.movie-displayer.js
Last active July 26, 2016 21:56
Component With Service
import Ember from 'ember';
export default Ember.Component.extend({
movieService: Ember.inject.service('movie-displayer-service'),
currentSelectedMovie: '',
didInsertElement: function() {
// When the component is inserted into the DOM tree, use the model to set
// the 'currentSelectedMovie' property.
this.set('currentSelectedMovie', this.get('model').currentSelectedMovie);
@phillipkregg
phillipkregg / components.application-area.js
Last active July 20, 2016 07:40
Application-Level Component
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement: function() {
// any JS inits that need to happen
// universally can be called here.
//
// For example if you need to register
// bootstrap dropdowns, you can do something
// like $('.dropdown-toggle').dropdown()
@phillipkregg
phillipkregg / components.cart-contents.js
Last active July 13, 2016 13:28
Services - Shopping Cart
import Ember from 'ember';
export default Ember.Component.extend({
// Here is where the injection of the service happens.
// Ember.inject.service takes an argument that is the name of the
// file of the service that you created.
// If your variable name matches the service name, you would not
// need to add the argument at all.
// For example: shopping-cart: Ember.inject.service()
cart: Ember.inject.service('shopping-cart'),
@phillipkregg
phillipkregg / components.my-component.js
Last active July 11, 2016 02:56
Listening for property changes outside of component
import Ember from 'ember';
export default Ember.Component.extend({
changedElement: Ember.observer('changeTest', function() {
alert('changed');
})
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Component.extend({
myInputValue: '',
actions: {
fromComponent: function() {
var message = this.get('myInputValue');
debugger;
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
goHome: function() {
this.transitionToRoute('index');
},
goToHotels: function() {
import Ember from 'ember';
export default Ember.Component.extend({
property1: undefined,
property2: undefined,
actions: {
coolClick: function() {
this.set('property1', 'Yo');
this.set('property2', 'Sup');
@phillipkregg
phillipkregg / frontendDevlopmentBookmarks.md
Created June 8, 2016 14:13 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.