This addon provides a best effort polyfill for the ember-factory-for
feature added in Ember 2.12.
Please review emberjs/rfcs#150 for more details.
ember install ember-factory-for-polyfill
import Ember from 'ember';
export default Ember.Service.extend({
someMethod() {
let owner = Ember.getOwner(this);
let ValidatorFactory = owner.factoryFor('validator:post');
let validator = ValidatorFactory.create();
}
});
After you upgrade your application to Ember 2.12, you should remove ember-factory-for-polyfill
from
your package.json
.
Addons generally support many different Ember versions, so leaving ember-factory-for-polyfill
in
place for consumers of your addon is perfectly normal. When the addon no longer supports Ember
versions older than 2.12, we recommend removing ember-factory-for-polyfill
from your package.json
and doing a major version bump.
This addon is tested against quite a few past Ember versions. Check config/ember-try.js
for the current list, but
the list of supported Ember versions at the time of authoring was:
- 2.3
- 2.4
- 2.8
- 2.12
- 2.13 (canary at the time)
For compatibility with older Ember versions prior to 2.3, please use ember-getowner-polyfill instead.
git clone <repository-url>
this repositorycd ember-factory-for-polyfill
npm install
bower install
ember serve
- Visit your app at http://localhost:4200.
npm test
(Runsember try:each
to test your addon against multiple Ember versions)ember test
ember test --server
ember build
For more information on using ember-cli, visit https://ember-cli.com/.