-
Notifications
You must be signed in to change notification settings - Fork 0
1) Get Started
Download this project.
Add an 'angular-hook-orm' folder into your lib or third-party folder.
Copy the 'angular-hook-orm.js' file into 'lib/angular-hook-orm' folder.
Include angular-hook-orm as a dependecy in your angular app
// js/app.js
var myApp = angular.module('myApp', ['angular-hook-orm']);Create an 'adapters' folder in the 'lib/angular-hook-orm' folder.
Select and copy the adapter you'd like to use in 'lib/angular-hook-orm/adapters' folder.
For instance, 'PouchDBAdapter.js'.
Download and include any adapter dependencies (PouchDBAdapter requires 'pouchdb' and 'pouchdb-find' version 6.2.0 +).
Create a 'HookConfig' factory as seen in the Configuration Template file ('HookConfigTemplate.js'), name it 'HookConfig.js' and place it anywhere in your project, for instance in your 'js/factories' folder and add your configuration details, similar to this:
// js/factories/HookConfig.js
angular.module('myApp').factory('HookConfig', HookConfig);
function HookConfig(){
function HookConfig(){
var c = this;
c.adapter = 'PouchDBAdapter';
c.database = {
name: 'myDB',
adapter: 'websql',
auto_compaction: true,
revs_limit: 1
};
c.db_debug = 'pouchdb:find';
c.entities = {
key: '_id',
table: 'myT',
relations: 'myR',
hooks: 'myH',
deleted: '_deleted'
};
c.repo = {
suffix: 'Repo'
};
}
return HookConfig;
}When you're done, your index file should look similar to this:
<!doctype html>
<html ng-app="myApp">
<head>
</head>
<body>
...
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script>
<script src="js/app.js"></script>
<script src="js/factories/HookConfig.js"></script>
<script src="lib/js/pouchdb/pouchdb-6.2.0.min.js"></script>
<script src="lib/js/pouchdb/pouchdb.find.js"></script>
<script src="lib/js/angular-hook-orm/angular-hook-orm.js"></script>
<script src="lib/js/angular-hook-orm/adapters/PouchDBAdapter.js"></script>
...
</body>
</html>