2

I have an app created with Cordova, Onsen (and Angular) working well on Android and iOS, and I want to export it on windows 8.1. When I run the app on Visual Studio , I get these errors :

Eccezione generata alla riga 1958, colonna 11 in ms-appx://xx.xxx.xxxx/www/lib/onsenui/js/angular/angular.js 0x800a139e - JavaScript runtime error: [$injector:nomod] Module 'ngLocale' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.4.3/$injector/nomod?p0=ngLocale

Eccezione generata alla riga 1958, colonna 11 in ms-appx://xx.xxx.xxxxx/www/lib/onsenui/js/angular/angular.js 0x800a139e - JavaScript runtime error: [$injector:nomod] Module 'templates-main' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.4.3/$injector/nomod?p0=templates-main

The app starts, loads the js content, but I have the idea that the Angular controller never starts... In the inspector in Visual Studio, I can see that there is no body tag loaded (inside the html tag there is only the head tag).

No other error is raised, so I'm thinking that the 2 errors are the cause of all.

I already have added winstore-jscompat.js library for making AngularJS work in app.

I searched everywhere for a solution, but I didn't find anything useful. (also here in Stackoverflow, I found a similar question, but nobody answered (https://stackoverflow.com/questions/33303379/error-nglocale-is-not-available-when-start-windows-8-1-app)

All is handled by a controller

<body ng-controller="AppController as app">

I hope that someone has some suggestion.

Thanks in advance


EDITED on 18.04.2016, after the comment below

I have only one module, and the bootstrap is done in this way:

var pmod = ons.bootstrap('pmod', ['onsen', 'ngSanitize']);

This is the controller:

pmod.controller('AppController', ["$scope", "$window", function($scope, $window){
var _self = this;

  ons.ready(function()
  {
        $("body").addClass("c_" + device.platform.toLowerCase());
        document.addEventListener("resume", onResume, false);
        home.refresh();
        navigator.splashscreen.hide();
        // other instructions here, working without errors ...
        // ...
  });

  // other functions here ...

  return _self;
}]);

In Visual Studio, when I run the app, I see this :

Screenshot of the DOM Inspector with the running up on the phone

As you can see I have no body tag.

Community
  • 1
  • 1
JD76
  • 73
  • 6
  • Take a look at [this blog post](http://www.johnpapa.net/easy-fix-to-a-common-angular-module-error/). It suggests checking the spelling of your modules and dependecies. If it doesn't help please add some more code, where we can see your `ng-app` and `angular.module()`. – Phonolog Apr 18 '16 at 13:45
  • Thanks for the answer. I already saw that article, but I didn't find any working solution for the app. I edited the question, so you can see more details. – JD76 Apr 19 '16 at 08:24

1 Answers1

0

After 2 weeks, I found that the solution was to create a new app from scratch, add an Onsen template, and then modify index.html and the app.js files with my code. And all started to work. It seems that the order of libraries inclusion was fundamental (now I have cordova.js called inside the body tag.

JD76
  • 73
  • 6