Perhaps this issue isn't related to AngularJS, but I'm still new to it and struggling to figure out what's going wrong. Can someone please point me in the right direction? I've been working on this for over 3 hours and it's really getting me down. :-(
I have a function where I pass my SQL queries along with other parameters. I want this function to be as flexible as possible.
prepareQuery('SELECT name FROM Lists WHERE id=(?)', [$scope.listId], listnameResultHandler(), defaultErrorHandler());
prepareQuery('SELECT * FROM Products', [], defaultResultHandler(), defaultErrorHandler());
To break this down:
- Parameter: SQL query
- Parameter: values bound to the query
- Parameter: the success function if the query is successful
- Parameter: the error function if there is a problem
Now, here is the prepareQuery function:
function prepareQuery(query, params, successHandler, errorHandler) {
$scope.db.transaction(function(tx){
tx.executeSql(query, params, successHandler, errorHandler);
}, errorCB);
}
The issue I'm facing is that I always receive a response from the defaultErrorHandler().
function defaultErrorHandler(err) {
alert("Error processing SQL: " + err.code);
}
And the error message always shows as: undefined.