Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic platform ready event fires twice

Does anyone know how to prevent the event from firing twice? I've tried using a controller scope level boolean variable to see if the event has already fired, but it did not work. It is like the event is firing on 2 separate threads and the variable was always false.

In the code below the $ionicPlatform.ready event is firing twice, but I can't figure out why.I'm using the current version of the Ionic Framework ionic-v1.0.0-beta.13.

angular.module('rsgApp.controllers', [])
.controller('MapCtrl', ['$ionicPlatform', 
function ($ionicPlatform) {  
    var vm = this;

    $ionicPlatform.ready(function () {
        alert('device is ready');
    });

 }]);
like image 302
GamerDev Avatar asked Sep 29 '22 10:09

GamerDev


1 Answers

Thanks TechMa9iac I was able to resolve this problem. In my tab template I had added an 'ng-controller' attribute to my ion-content tag. This is what was causing the $ionicPlatform.ready event to fire twice.

like image 128
GamerDev Avatar answered Oct 05 '22 07:10

GamerDev