2

I'm having trouble loading angularJS template on phoneGap. I'm using the android simulator via intellij phonegap Plugin. I went here, Angular ng-view/routing not working in PhoneGap, already.

My loginRoute.js looks like this:

module.config(['$routeProvider', '$compileProvider', function($routeProvider, $compileProvider) {
  $compileProvider.urlSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel):/);
        $routeProvider
            .when('/', {
                    templateUrl:'login/auth_view.html'
            });
}]);

Part of my index.html where I insert all my javaScript files:

<html class="no-js" ng-app="Module">
<div ng-view></div>
<script type="text/javascript" src="module.js"></script>
<script type="text/javascript" src="index.js"></script>
<script type="text/javascript" src="login/loginRoute.js"></script>
<script type="text/javascript" src="login/loginController.js"></script>
<script type="text/javascript" src="login/loginDirective.js"></script>
<script type="text/javascript" src="login/loginService.js"></script>

<script type="text/javascript">
  function onDeviceReady() {

    angular.bootstrap(document, ['ngView']);
  }
  document.addEventListener("deviceready", onDeviceReady, true);
</script>
</html>

The index.js:

var Module = {
  initialize: function() {
    this.bindEvents();
  },
  bindEvents: function() {
    document.addEventListener('deviceready', this.onDeviceReady, true);
  },

  onDeviceReady: function() {
    angular.element(document).ready(function() {
      angular.bootstrap(document);
    });
  }
};

And finaly my module.js:

var module = angular.module('Module', [
  'ngAria',
    'ngResource',
    'ngRoute',
    'ngMaterial',
    'leaflet-directive'
]);

The error I can see on the logs of my android emulator (with this command: adb -s emulator-5554 logcat):

I/chromium( 2918): [INFO:CONSOLE(11594)] "Error: [$compile:tpload] Failed to         load template: /log
in/auth_view.html

I/chromium( 2918): http://errors.angularjs.org/1.3.8/$compile/tpload?   p0=%2Flogin%2Fauth_view.htm
l

So I've tried so many things. The only thing I'm able to do, is to go on the index.html page(implyiing that I can see any text I write on my html page).None of the SO solutions about this topic worked for me. I think I missed something in the process..

Community
  • 1
  • 1
Arthur Leh
  • 21
  • 5

0 Answers0