@codiqa100098546 wrote:
Hi,
In SQLite I have a table:
- settings
-- setting
-- valueSchema:
SETTING | VALUE
trybstudiow | abcd
grupa | abcdefservices.js:
angular.module('myapp')
.factory('TTJSON', function($http) {
var dataSource = 'http://my-site.com/json.php?callback=JSON_CALLBACK';return {
getData: function(uczelniab) {
return $http.jsonp(dataSource, {
params: {
id: uczelniab
}
});
}
}
});and app.js:
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('TT-ActualWeek', {
url: '/actual-week',
templateUrl: 'templates/TT-ActualWeek.html',
controller: 'TTController',
controllerAs: 'TT'
}).state('TT-NextWeek', {
url: '/next-week',
templateUrl: 'templates/TT-NextWeek.html',
controller: 'TTController',
controllerAs: 'TT'
})$urlRouterProvider.otherwise('/actual-week');
})and (in app.js too):
.controller('TTController', function(TTJSON, $scope, $cordovaSQLite, $scope, $window, $ionicLoading, $ionicModal, $stateParams) {
$cordovaSQLite.execute(db, 'SELECT ( SELECT value FROM settings WHERE setting LIKE "trybstudiow" ) AS sqltryb, ( SELECT value FROM settings WHERE setting LIKE "grupa" ) AS sqlgrupa;')
.then(
function(res) {
if (res.rows.length > 0) {
$stateParams.uczelniab = 'aaa';
$scope.uczelnia={
TrybStudiow: res.rows.item(0).sqltryb,
Grupa: res.rows.item(0).sqlgrupa
}
}
}
);How can I "insert" those SQLite records in JSONP (GET) request? I tried StateParams, rootScope, scope and many others...
Posts: 1
Participants: 1