This repository has been archived by the owner on Sep 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Installation and Setup
Juri Strumpflohner edited this page Nov 17, 2015
·
3 revisions
Model-factory can be installed either through npm..
$ npm install angular-model-factory --save
..or Bower
$ bower install angular-model-factory --save
or you can fork our GitHub repo and manually include the proper files from the dist
folder. Note, the dist
folder is in our latest
branch.
The distribution packages will install angular-model-factory
and the dependencies; deep-diff
and uri-templates
. Include these in your application. Bower example:
<script data-main="main" src="bower_components/deep-diff/index.js"></script>
<script data-main="main" src="bower_components/uri-templates/uri-templates.js"></script>
<script data-main="main" src="bower_components/model-factory/dist/angular-model-factory.js"></script>
or with RequireJS like:
require.config({
paths: {
angular: 'bower_components/angular/angular',
'deep-diff': 'bower_components/deep-diff/index',
'uri-templates': 'bower_components/uri-templates/uri-templates',
'angular-model-factory': 'bower_components/model-factory/dist/angular-model-factory'
},
shim: {
angular: {
exports: 'angular'
},
'deep-diff': {
exports: 'DeepDiff'
},
'angular-model-factory': [
'angular',
'uri-templates',
'deep-diff'
]
}
});
Add modelFactory
as dependency to your angular module like:
var app = angular.module('myapp', ['modelFactory'])
You can configure the API prefix to be used with modelFactory.
angular
.module('myapp', ['modelFactory'])
.config(function($modelFactoryProvider) {
$modelFactoryProvider.defaultOptions.prefix = 'api/v1';
});
Enjoy magic ;)