Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pixelhandler/533c63cafba79951417e490f91957c2a to your computer and use it in GitHub Desktop.
Save pixelhandler/533c63cafba79951417e490f91957c2a to your computer and use it in GitHub Desktop.
MVCE for emberjs/emberjs#15059
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',
rootURL: config.rootURL
});
Router.map(function() {
this.route('files', function() {
this.route('file', { path: '*path' });
});
this.route('rootfiles', function() {
this.route('rootfile', { path: ':path' });
});
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
model(params) {
return {
paramsPath: params.path,
decodedPath: decodeURI(params.path)
};
}
});
import Ember from 'ember';
export default Ember.Route.extend({
model(params) {
return {
paramsPath: params.path,
decodedPath: decodeURI(params.path)
};
}
});
<h1>Welcome to {{appName}}</h1>
<br>
{{link-to 'non-glob example' 'rootfiles.rootfile' '/files/my file with spaces.json'}}
{{link-to 'glob example' 'files.file' '/files/my file with spaces.json'}}
<br>
<br>
{{outlet}}
<br>
<br>
<p>params.path: {{model.paramsPath}}</p>
<p>decodeURI(params.path): {{model.decodedPath}}</p>
<p>params.path: {{model.paramsPath}}</p>
<p>decodeURI(params.path): {{model.decodedPath}}</p>
{
"version": "0.15.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": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment