I am currently working on an electron app that is supposed to display and retrieve items from a SQL database I created. However, I keep encountering an unknown provider error.
Despite trying various solutions found online, the issue persists and I am unable to pinpoint where I might be going wrong.
Below is my angular service for connecting to the database (dbService.js)
app.factory("dbService", function ($http) {
var sqlite = require('sqlite-sync');
var db = sqlite.connect('model/database.db');
return db;
});
Next, here is my controller (salesController.js)
app.controller("salesController", function ($scope, $location, $dbService) {
$scope.sub = {
'title': 'Sales Management'
}
$scope.listSales = function () {
dbService.runAsync("SELECT * FROM sales WHERE active = 1", function (data) {
$scope.sales = data;
});
}
});
And this is my module (app.js)
var app = angular.module('bpApp', ['ui.router', 'angularUtils.directives.dirPagination']);
Finally, I have added code to display data in my table (sales.html)
....
<tbody>
<tr class="bz-tablecell" dir-paginate="sale in sales|filter:search|itemsPerPage:8">
<td id="table-checkbox"><input type="checkbox"></td>
<td style="font-weight: 600">{{sale.name}}</td>
<td>{{sale.amount}}</td>
<td>{{sale.quantity}}</td>
<td><a href="#">{{sale.customer}}</a></td>
<td>{{sale.date}}</td>
<td class="export-ignore"><span class="approved" style="border-radius: 0 !important;">{{sale.status}}</span></td>
<td class="export-ignore"><a href="#">Manage</a></td>
</tr>
</tbody>
...
All necessary files are included in index.html, which loads sale.html via ui-view. The view loads successfully, but data is not being retrieved from the database, leading to the following error:
Error: [$injector:unpr] Unknown provider: $dbServiceProvider <- $dbService <- salesController
If anyone can offer guidance on resolving this issue, it would be greatly appreciated...