Angularjs 使用WEBSQL创建数据库时未定义$scope.db?

Angularjs 使用WEBSQL创建数据库时未定义$scope.db?,angularjs,web-sql,Angularjs,Web Sql,我正在使用位于的Angular Websql创建Websql数据库。 这是我在控制器中的代码: 你可以在我的pInkr.co上看到 当我在我的计算机上运行时,它有错误:$scope.db未定义,openDatabase未定义。当我添加一个新函数showAll时,它会出错。 我在代码中找不到任何错误。 请帮我解决这个问题。你能准备一些最简单的代码来复制吗?这是我的pInkr.co:我不知道为什么当我在pInkr.co上运行时,openDatabase没有错误,就像我在我的计算机上运行时一样。现在我

我正在使用位于的Angular Websql创建Websql数据库。 这是我在控制器中的代码:

你可以在我的pInkr.co上看到 当我在我的计算机上运行时,它有错误:$scope.db未定义,openDatabase未定义。当我添加一个新函数showAll时,它会出错。 我在代码中找不到任何错误。
请帮我解决这个问题。

你能准备一些最简单的代码来复制吗?这是我的pInkr.co:我不知道为什么当我在pInkr.co上运行时,openDatabase没有错误,就像我在我的计算机上运行时一样。现在我添加了新函数ShowAll,但它出现了错误: angular.module('myCtrl', ['angular-websql']) .controller('AdminCtrl', function($scope, $webSql){ $scope.db = $webSql.openDatabase('MyDB', '1.0', 'My Database', 5*1024*1024); $scope.db.createTable('TemplateTbl', { "id": { "type": "INTEGER", "null": "NOT NULL", "primary": true, "auto_increment": true }, "tempTitle": { "type": "TEXT", "null": "NOT NULL" }, "tempContent": { "type": "TEXT", "null": "NOT NULL" }, "tempInstruction": { "type": "TEXT", "null": "NULL" }, "tempSentences": { "type": "TEXT", "null": "NULL" }, "categoryID": { "type": "INTEGER", "null": "NOT NULL" }, "dateCreated": { "type": "TIMESTAMP", "null": "NOT NULL", "default": "CURRENT_TIMESTAMP" } }); $scope.addTemplate = function(){ $scope.db.insert('TemplateTbl',{ "tempTitle": $scope.template.title, "tempContent": $scope.template.content, "tempInstruction": $scope.template.instruction, "tempSentences": $scope.template.sentences, "categoryID": $scope.template.category }); }; })