Despite the lengthy title, I couldn't think of a better one for my specific situation. If you have any suggestions, feel free to share! Essentially, I've outlined the issue I'm grappling with in a simplified version on this JSFiddle. In this case, I'm utilizing AngularJS's $q.all
method to gather an array of promises that are dependent on query results:
db.transaction(function(tx) {
$q.all(fn(tx)).then(function(a) {
console.log("Result:", a);
});
});
Here, the code operates smoothly as anticipated, and the resulting array of SQL query outcomes (which resolve the promises) is correctly displayed via console.log
. However, if I encase $q.all
within the then
method of another deferred object like so:
db.transaction(function(tx) {
fn2(tx).then(function(tx) {
$q.all(fn(tx)).then(function(a) {
console.log("Result:", a);
});
});
});
An error surfaces:
Error: Failed to execute 'executeSql' on 'SQLTransaction': SQL execution is disallowed.
(fn2
is simply a function that returns a promise resolving to the tx
object itself). Could this be a common stumbling block? Despite my research efforts, I haven't come across any relevant information. Thanks.