Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Ionic deviceready event versus ionicPlatform.ready

$
0
0

@Drunk wrote:

I am using cordovaVibration and cordovaSQLite plugins, and noticed what if i try to initiate them like that

$scope.toggle = function () {
    document.addEventListener('deviceready', function () {
        var db = $cordovaSQLite.openDB({name: "magic"});
    }, false);
};

Everything works fine (webrowser via ionic serve and built app on mobile, both good), but when i am trying to

$ionicPlatform.ready(function(){
    var db = $cordovaSQLite.openDB({name: "magic"});
});

or

ionic.Platform.ready(function(){
    var db = $cordovaSQLite.openDB({name: "magic"});
});

I am getting error Uncaught TypeError: Cannot read property 'openDatabase' of undefined
and it's same for vibration plugin.

.controller('flowCtrl', function ($scope, $cordovaSQLite, $ionicPlatform) { ...

$ionicPlatform dependency is added to controller, so i can't imagine why ready method isn't working properly

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>