-
-
Save OmShiv/76effcf738afb475a5a8ca2ed37c2147 to your computer and use it in GitHub Desktop.
Inheritance and Complex Types in Definitions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ComponentOne from './component-one'; | |
import ComponentA from '../mixins/component-a'; | |
export default ComponentOne.extend(ComponentA, { | |
type: 'Component Five', | |
description: 'Extends Component One and includes Component A. Overrides obj in definition.', | |
obj: { | |
val: 5 | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ComponentOne from './component-one'; | |
import ComponentA from '../mixins/component-a'; | |
export default ComponentOne.extend(ComponentA, { | |
type: 'Component Four', | |
description: 'Extends Component One and includes Component A. Doesn\'t override obj in definition.', | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import layout from '../templates/components/component-one'; | |
export default Ember.Component.extend({ | |
layout, | |
type: 'Component One', | |
description: 'The base component', | |
obj: { | |
val: 1 | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ComponentOne from './component-one'; | |
import ComponentA from '../mixins/component-a'; | |
export default ComponentOne.extend(ComponentA, { | |
type: 'Component Six', | |
description: 'Extends Component One. Includes Component A. Handles setting obj correctly in init.', | |
init() { | |
this._super(...arguments); | |
this.obj = { | |
val: 6 | |
}; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ComponentOne from './component-one'; | |
import ComponentA from '../mixins/component-a'; | |
export default ComponentOne.extend(ComponentA); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ComponentOne from './component-one'; | |
export default ComponentOne.extend({ | |
type: 'Component Two', | |
description: 'Extends component one', | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Mixin from '@ember/object/mixin'; | |
export default Mixin.create({ | |
type: 'Component A', | |
description: 'The mixin description', | |
obj: { | |
val: 'A' | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.14.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.18.2", | |
"ember-template-compiler": "2.18.2", | |
"ember-testing": "2.18.2" | |
}, | |
"addons": { | |
"ember-data": "2.18.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment