Skip to content

Instantly share code, notes, and snippets.

@kumkanillam
Last active February 26, 2019 08:04
Show Gist options
  • Save kumkanillam/7bcee950caf538b87eac0e42b384a7eb to your computer and use it in GitHub Desktop.
Save kumkanillam/7bcee950caf538b87eac0e42b384a7eb to your computer and use it in GitHub Desktop.
MixinPropsChnagedInComponent
import Ember from 'ember';
export default Ember.Component.extend({
init(){
this._super(...arguments);
console.log('pricing component init ',this.get('adminCount'));
},
didInsertElement(){
this._super(...arguments);
},
didReceiveAttrs(){
this._super(...arguments);
console.log('didReceiveAttrs');
this.set('adminCount',2);
},
actions:{
pricingPagePrint(){
this.set('adminCount',this.get('adminCount')+1);
console.log('pricingPagePrint :',this.get('adminCount'));
}
}
});
import Ember from 'ember';
import PricingController from 'twiddle/mixins/pricing-controller';
export default Ember.Controller.extend(PricingController,{
appName: 'Ember Twiddle',
init(){
this._super(...arguments);
console.log('application init');
},
actions:{
showPopup(){
console.log('showpopup ',this.get('adminCount'));
//this.toggleProperty('showPopup');
this.set('appName','change');
}
}
});
import Ember from 'ember';
export default Ember.Mixin.create({
adminCount:1,
showPopup:false,
init(){
this._super(...arguments);
console.log('init pricing controller ');
}
});
<h1>Welcome to {{appName}}</h1>
<br>
Application.hbs {{adminCount}}
{{pricing-user-edition adminCount=adminCount showPopup=showPopup}}
<br>
<button {{action 'showPopup'}}> Show Popup </button>
{{outlet}}
<br>
<br>
Pricing User Edition: {{adminCount}}
{{#if showPopup}}
{{showPopup}}
{{/if}}
<button {{action 'pricingPagePrint'}}>PricingPagePrint</button>
{{yield}}
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "2.14.1",
"ember-template-compiler": "2.14.1",
"ember-testing": "2.14.1"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment