Skip to content

Instantly share code, notes, and snippets.

@Gaurav0
Last active March 8, 2016 06:04
Show Gist options
  • Save Gaurav0/1c0da49ac7eab2af3d77 to your computer and use it in GitHub Desktop.
Save Gaurav0/1c0da49ac7eab2af3d77 to your computer and use it in GitHub Desktop.
View Stack
export default Ember.Component.extend(App.AddableMixin, {
layoutName: 'components/bar-baz',
classNames: ['bar-baz'],
_createBaz: function() {
Ember.run.schedule('afterRender', function() {
console.log(this.$().innerHTML);
}.bind(this));
}.on('didInsertElement')
});
import BarBazComponent from "components/bar-baz";
export default Ember.Component.extend({
_createBar: function() {
BarBazComponent.create({ container: this.get('container')});
}.on('didInsertElement')
});
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
export default Ember.Mixin.create({
_addIt: function() {
window.viewStack.push(this);
}.on('init')
});
Welcome to Ember.js
{{foo-bar}}
<b class="foo-bar">Foo Bar</b>
{
"version": "0.6.2",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.1/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.1/ember-template-compiler.js"
}
}
import ViewStack from "views/view-stack";
export default Ember.View.extend({
_setup: function() {
window.viewStack = ViewStack.create();
}.on('willInsertElement'),
_render: function() {
window.viewStack.append();
}.on('didInsertElement')
});
export default Ember.ContainerView.extend({
push: function(view) {
this.pushObject(view);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment