Skip to content

Instantly share code, notes, and snippets.

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()
import Ember from 'ember';
export default Ember.Component.extend({
currentlySelectedRestaurant: undefined,
actions: {
selectRestaurant: function(restaurant) {
// The 'sendAction' method is where the magic happens.
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);
@kumkanillam
kumkanillam / controllers.application.js
Created July 28, 2016 06:24
checkbox change with mut helper
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
statusObj:{status:false},
actions:{
test(){
console.log('test',this.get('statusObj'));
}
}
@kumkanillam
kumkanillam / components.sachin-c.js
Created July 28, 2016 13:48
yield and block parameters concept in components
import Ember from 'ember';
export default Ember.Component.extend({
childname:'arjun',
childage:25,
actions:{
changeCname(value){
console.log('changeCname');
this.set('cname',value);
}
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@kumkanillam
kumkanillam / controllers.application.js
Last active July 29, 2016 18:36
Service - Array observer sample
import Ember from 'ember';
export default Ember.Controller.extend({
cart:Ember.inject.service(),
actions:{
addEntry(){
this.get('cart').addEntry();
}
}
});
@kumkanillam
kumkanillam / controllers.application.js
Last active August 2, 2016 19:41
Kumkan-action bubble
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
isAuthenticated: true,
actions: {
logIn: function(){
this.toggleProperty('isAuthenticated');
console.log('login application ',this.get('isAuthenticated'));
}
@kumkanillam
kumkanillam / components.child-a.js
Last active August 17, 2016 11:32
Demo -Parent-Child-Component-interaction
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement(){
this._super(...arguments);
console.log('didInsertElement in child-a');
},
didRender(){
this._super(...arguments);
console.log('didRender in child-a');
@kumkanillam
kumkanillam / controllers.application.js
Created August 6, 2016 13:20
Dropdwon-default selected
import Ember from 'ember';
export default Ember.Controller.extend({
lang: 'phpurl',
actions: {
selectOption: function(option) {
console.log(option);
this.set("lang", option);
}
}