Skip to content

Instantly share code, notes, and snippets.

View ASH-Michael's full-sized avatar

Michael Serna ASH-Michael

  • American Specialty Health
View GitHub Profile
@ASH-Michael
ASH-Michael / controllers.application.js
Last active February 7, 2020 17:37
Overwriting Computed Properties
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);
@ASH-Michael
ASH-Michael / components.my-component.js
Last active January 15, 2020 20:20
set vs defineProperty
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);
@ASH-Michael
ASH-Michael / components.addon-component.js
Last active January 6, 2020 22:04
Component Namespacing
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['addon-component']
});
@ASH-Michael
ASH-Michael / components.my-component.js
Last active May 7, 2021 21:10
Component Stacking Contexts
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['my-component']
});
@ASH-Michael
ASH-Michael / components.result-item.js
Last active August 14, 2019 15:10
SVG Accessibility
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'li',
classNameBindings: ['status'],
status: 'notok'
});
@ASH-Michael
ASH-Michael / controllers.application.js
Last active July 31, 2019 01:08
Link and Button Experimentation
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
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 October 14, 2020 18:50
Presentation Components within a Presentationless Component
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',
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['first-component component']
});