ember-cli Mode Resolver
Custom resolver to allow the same route to be resolved as different modes of the application. Mode is determined by configuration. (A common use case would be a/b testing)
Installation
ember install ember-cli-mode-resolver
Usage
Configuration
In your app root (app.js
) add import of the mode resolver module:
Then oveveride the default resolver with mode resolver and define mode configuration:
var App; EmberMODEL_FACTORY_INJECTIONS = true; App = EmberApplication;
Naming Convention
In order to have a module used when a certain mode is configure, add a the concatenation of mode delimiter and mode id as a postfix to the module file name. For example if the mode configration is:
resolverMode: id: "a" delimiter: "~"
and we have a 'fooit' route module at /routes/fooit.js
, we can add an altenative 'fooit' route module that will be resolved in when mode 'a' id configured - /routes/fooit~a.js
.
Pods
The equaivalent case when using pods would be an alrenative to /fooit/route.js
.
In this case we will create an alternative 'fooit' pod folder named 'fooit~a' and place the alternative 'route.js' module file there so alternative route module file will be at /fooit~a/route.js
.
Running
ember server
- Visit your app at http://localhost:4200.
Running Tests
ember test
ember test --server
Building
ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.