Include fake data in your app for testing or prototyping.
npm install ember-faker
Ember addon wrapper for Faker.js.
``bash`
ember install ember-faker
#### ember-cli 0.1.5 - 0.2.2
`bash`
ember install:addon ember-faker
Import the faker module with import faker from 'faker'. Then you can use it as a default
value for dummy data:
`javascript
import faker from 'faker';
export default DS.Model.extend({
firstName: DS.attr('string', {
defaultValue: function() {
return faker.name.firstName();
}
})
});
`
Or manually set attributes for tests or prototypes:
`javascript
import faker from 'faker';
// ...
user.set('firstName', faker.name.firstName());
user.set('lastName', faker.name.lastName());
`
By default faker is included into your build for non-production
environments. To include it in production, add this
to your config:
`js`
// ember-cli-build.js
let app = new EmberApp(defaults, {
'ember-faker': {
enabled: EmberApp.env === 'production'
}
});
* git clone this repositorynpm install
* bower install
*
* ember server
* Visit your app at http://localhost:4200.
* ember testember test --server
*
* ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.
MIT
1. Fork it
2. Create your feature branch (git checkout -b my-new-feature)git commit -am 'Add some feature'
3. Commit your changes ()git push origin my-new-feature`)
4. Push to the branch (
5. Create new Pull Request
* Faker.js for the fake data.
* ember-cli-pretender for the shim example.
Crafted with <3 by John Otander (@4lpine).