0

I've working in Cordova app with Angularjs and all looks fine in Chrome and other browsers. But if I try install the apk to Android, Angularjs not execute the index.html in the launch.

However, that's is the weirdest: if I change for other pages and go back to the index.html, all looks fine! And if I close the app and relaunch, everything goes to normal. And sometimes, just in few times, it repeats, only in the index.html.

My index.html when launch:

enter image description here

Just as I said, the pages works fine in the most cases:

enter image description here

I'm using Android 7.1.1 / Cordova 7.0.1 / Angular 1.6.4

index.html: (Each 'ng-init' inside 'ng-owl-carousel' makes a $http request)

    <!DOCTYPE html>
<html ng-app="baseApp">
<head>
<link rel="stylesheet" href="css/uikit.css" />
<link rel="stylesheet" href="css/header.css" />
<link rel="stylesheet" href="css/custom.css" />
<link rel="stylesheet" href="css/owl.carousel.min.css">
<link rel="stylesheet" href="css/animate.css" />

<script src="js/jquery.js"></script>
<script src="js/uikit.min.js"></script>
<script src="js/owl.carousel.js"></script>
<script src="js/angular.min.js"></script>
<script src="js/angular-owl-carousel-2.js"></script>
<script src="js/index.js"></script>
<script src="js/controller-home.js"></script>
<script src="js/controller-list.js"></script>
<script src="js/controller-rede.js"></script>
<script src="js/controller-config.js"></script>

</head>
<body ng-controller="carousel" ng-cloak>
<header ng-include="'templates/header-search.html'"></header>

<section>
<ng-owl-carousel class="owl-theme" owl-items="items" owl-properties="properties" owl-ready="ready($api)">
<div ng-controller="home">
<div ng-include="'templates/home.html'" ng-show="owl_page == 0" ng-init="init_home();"></div>
</div>
<div ng-controller="listas">
<div ng-include="'templates/listas.html'" ng-show="owl_page == 1" ng-init="init_listas();"></div>
</div>
<div ng-controller="rede">
<div ng-include="'templates/rede.html'" ng-show="owl_page == 2" ng-init="generalSearchFilter('notify');"></div>
</div>
<div ng-controller="config">
<div ng-include="'templates/config.html'" ng-show="owl_page == 3" ng-init="init_config();"></div>
</div>
</ng-owl-carousel>
</section>

<footer id="footer" ng-include="'templates/footer.html'"></footer>

<script src="cordova.js"></script>
</body>
</html>
ASilva
  • 1
  • 2

1 Answers1

0

After some days I decided to change all my index.html and I change my code to use $routeProvider instead ng-include, also I replace my initial function with a 'angular.element(document).ready' + $timeout. Happy end! :)

ASilva
  • 1
  • 2