Skip to content

Instantly share code, notes, and snippets.

@munsellj
Last active December 1, 2016 09:18
Show Gist options
  • Save munsellj/008932c6a02fe3e8c204136e18762eb2 to your computer and use it in GitHub Desktop.
Save munsellj/008932c6a02fe3e8c204136e18762eb2 to your computer and use it in GitHub Desktop.
Component Destroy on Route Change
import Ember from 'ember';
export default Ember.Component.extend({
model: {name: null}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none'
});
Router.map(function() {
this.route('parent', function() {
this.route('child');
});
});
export default Router;
<form>
{{input type="text" placeholder="Your Name" value=model.name}}
</form>
<h1>Application Index Route</h1>
<br/>
{{#link-to 'parent'}}Go To Parent Route{{/link-to}}
<hr/>
<h2>Child Route</h2>
<div>{{#link-to 'application'}}Go Back to App Root{{/link-to}}</div>
<div>{{#link-to 'parent'}}Go Back to Parent{{/link-to}}</div>
{{basic-form}}
<h1>Parent Route</h1>
<div>
{{outlet}}
</div>
{{#link-to 'parent.child'}}Go To Child Route{{/link-to}}
{
"version": "0.7.2",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.4.4",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.3/ember-data.js",
"ember-template-compiler": "2.4.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment