productsController.js

controllers.controller('ProductsController', ['$scope', '$ionicPlatform', 'Products' function ($scope, $ionicPlatform, Products) { $scope.products = []; $scope.product = { IdProduct: 1, Name: 'Pizza', Icon: 'ion-pizza', Color: '#F056C2' }; $ionicPlatform.ready(function () { Products.createTable().then(function(){ return Products.addProduct($scope.product); //Insert a new product }).then(function () { return Products.getProducts(); //Get Products }).then(function (products) { $scope.products = angular.copy(products); }).catch(function (err) { console.log(err); }); }); } ]);
SQLite plugin with ngCordova in Ionic Framework => Using service pattern (Works for litehelpers/Cordova-sqlite-storage and MSOpenTech/cordova-plugin-websql) Code => http://1drv.ms/1Ono0Ys

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.