Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am using Angular Websql (which is at https://github.com/paulocaldeira17/angular-websql) to create WEBSQL database.
This is my code in controller:


    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
        });
      };
    })

You can see it at my pInkr.co
When I run on my computer, it has errors: $scope.db is undefined and openDatabase is not defined.
When I add a new function showAll(), it gets error. I can't find any error in my code. Please help me to solve this.

share|improve this question
    
could you prepare some minimal code to reproduce at plnkr.co? –  Egor Smirnov Aug 10 '14 at 10:40
    
This is my pInkr.co: plnkr.co/edit/a6FazK6pSRGHrGvNNvFT?p=preview I don't know why when I run on pInkr.co, it has no error with openDatabase like when I run on my computer. Now I add new function ShowAll and it got error :( –  James Do Aug 11 '14 at 2:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.