Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Serna ASH-Michael

  • American Specialty Health
View GitHub Profile
@ASH-Michael
ASH-Michael / controllers.application.js
Last active Feb 7, 2020
Overwriting Computed Properties
View controllers.application.js
import Controller from '@ember/controller';
import { computed, set } from '@ember/object';
import { alias, oneWay } from '@ember/object/computed';
export default Controller.extend({
// demo 1
color1: 'red',
color2: 'blue',
color3: computed('color1', 'color2', function() {
const same = this._checkIfSame(this.color1, this.color2);
View components.my-component.js
import Component from '@ember/component';
import { computed, set } from '@ember/object';
import { inject as service } from '@ember/service';
export default Component.extend({
myService: service(),
computeComponentProperties: computed('componentProp1', 'componentProp2', function() {
const statement = `The computed properties on the component are <b>property1: "${this.componentProp1}"</b> and <b>property2: "${this.componentProp2}"</b>`;
console.log(statement);
View components.addon-component.js
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['addon-component']
});
@ASH-Michael
ASH-Michael / components.my-component.js
Last active Jun 25, 2020
Component Stacking Contexts
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['my-component']
});
View components.result-item.js
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'li',
classNameBindings: ['status'],
status: 'notok'
});
@ASH-Michael
ASH-Michael / controllers.application.js
Last active Jul 31, 2019
Link and Button Experimentation
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View components.base-widget.js
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['profile-widget'],
classNameBindings: ['isInset:content-inset:content-full'],
isInset: true,
hasArgs: false,
didReceiveAttrs() {
@ASH-Michael
ASH-Michael / components.api-component.js
Last active Aug 3, 2018
Presentation Components within a Presentationless Component
View components.api-component.js
import Component from '@ember/component';
import { computed, get } from '@ember/object';
import { htmlSafe } from '@ember/string';
export default Component.extend({
centerName: 'Orange Theory',
centerProfile: 'https://fakeimg.pl/120x120/',
centerAddress: '32435 Temecula Pkwy',
centerCity: 'Temecula',
centerState: 'CA',
View components.first-component.js
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['first-component component']
});
You can’t perform that action at this time.