Currently, I am delving into the realm of utilizing PouchDB within an AngularJS environment. My reference point is these guiding instructions located at https://github.com/wspringer/angular-pouchdb
The stumbling block I face pertains to grasping the syntax necessary for crafting factories or services. My progress halts upon reaching the segment on "Interacting with the database"
app.js
'use strict';
angular
.module('myappApp', [
'ngCookies',
'ngResource',
'ngSanitize',
'ngRoute',
'pouchdb'
])
.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.otherwise({
redirectTo: '/'
});
})
angular.factory('someservice', function(pouchdb) {
// Leverage pouchdb capabilities here.
var db = pouchdb.create('testdb');
pouchdb.destroy('testdb');
db.put({_id: 'foo', name: 'bar'});
});
Upon integrating the "db.put", The error message that surfaces in the browser’s console states:
[15:17:45.343] TypeError: angular.factory is not a function @ http://127.0.0.1:9000/scripts/app.js:21