Sunday, 15 June 2014

ember.js - Ember CLI, locationType: ‘hash’, and serving index.html for all URLs -


I have a special case of use where I want to use URL hash for routing inside amber, and I For the path part

For example:

  localhost: 4200 / # / properties / edit  

Work at:

  localhost: about 4200 / / / properties / edit  

or this:

 < Code> Localhost: 4200 / Products / Widgets / Model-5000 / # / Property / Edit  

Example navigate between URLs, it takes a 100% would be acceptable, any hash changes in a full page refresh, however, URL "single page".

I want to point out the app / index.html file for all these URLs and the way to "amaze the route" for amber CLI, but How do I configure Amber CLI to do this while serving the app? For example, the / about scenario above gives me an error GET / about can not do.

Is this plain vanilla amber possible with CLI, or do I need to do something like [code> amber-cli-rail [/ code>] for more flexible routing in development? I thought it would be relatively easy to configure it to work properly in production, but I need anything that works for development.

Yes, you can use wildcards:

Amber 'amber' 'Import; './config/environment';

var router = Configure import from Ember.Router.extend ({location: config.locationType});

  router.map (function () {this.resource ('index', {path: "/ * wildcard"}, function () {this.route ("property", function ( ) {This.route ("edit");});});}); Export the default router;  

No comments:

Post a Comment