I'm currently developing a mobile application using AngularJS, OnsenUI, and PhoneGap to package it for Android devices.
However, I've encountered a strange issue where an alert box pops up twice when the application is run as a new process. I'm completely stumped as to why this is happening...any thoughts or suggestions?
The core of my app lies in the Application.js file, which serves as the main bootstrap for the entire AngularJS application. The logic of my code begins in MainController.js, the primary controller.
If you'd like to take a look at the code, it can be found on GitHub: https://github.com/jorisbrauns/Gloss/
Note: I attempted wrapping the code within this controller with ons.ready(function() { // However, this did not resolve the duplicate alert issue ... :-( })();
Below is a snippet where the alert is being triggered:
(function (app) {
'use strict';
app.controller('MainController', ['$scope', 'authService', function ($scope, authService) {
//Retrieve object from local storage
$scope.authentication = authService.authentication;
//This alert seems to appear twice mysteriously
alert("isAuth: " + $scope.authentication.isAuth + " / username: " + $scope.authentication.userName);
//Determine which page to display
if (page.name == "") {
if ($scope.authentication.isAuth) {
_RedirectToMain();
} else {
$scope.mainNavigation.pushPage("views/login.html", {
animation: 'none',
onTransitionEnd: function() {}
});
}
}
// Additional code continues below, unrelated to the suspected issue
})(application);