0

I have a angular(v1.3.6) application running on cordova. I want to use ng-route(v1.3.6) but while setting up the route-provider, i take surprisingly the following error:

enter image description here

Here you see my application configuration:

puntenApp.config(function ($routeProvider) {

$routeProvider
            .when('/pb', {
                templateUrl : 'js/pages/pb.html',
                controller  : 'pbController'
            })
            .when('/login', {
                templateUrl : 'js/pages/Login.html',
                controller  : 'configuratieController'
            });
});

I have no idea why it is interpreted as a cross origin request (even if i take the html files in the same folder) and what should i do?

Asqan
  • 4,319
  • 11
  • 61
  • 100
  • how do you run your code, from a server or from `file://` ? – pbaris Sep 07 '15 at 08:10
  • from the file where i created my cordova application. – Asqan Sep 07 '15 at 08:16
  • May be helpful: http://stackoverflow.com/questions/25914071/cors-cordova-angularjs-http-and-file-confusion – Michael Radionov Sep 07 '15 at 09:07
  • Yes, I'm reading that too but normally, i shouldn't get this kind of error: http://stackoverflow.com/questions/15105910/angular-ng-view-routing-not-working-in-phonegap The current state of my app is less or more the same with it. And i didn't read that anyone using ng-route gets such an error – Asqan Sep 07 '15 at 09:13

1 Answers1

0

You have erros in your javascript. You chain function when of $routeProvider so you have to remove the extra ;.

So your code should be

puntenApp.config(function ($routeProvider) {

    $routeProvider
        .when('/pb', {
            templateUrl : 'js/pages/pb.html',
            controller  : 'pbController'
        })
        .when('/login', {
            templateUrl : 'js/pages/Login.html',
            controller  : 'configuratieController'
        });
});
pbaris
  • 4,525
  • 5
  • 37
  • 61
  • my fault, i made that mistake while i'm writing the code here. It was already without extra `;` so, itm still getting the same error. I've updated my question – Asqan Sep 07 '15 at 08:03
  • i don't know if it is a typo error, but you have an extra `;` in `$routeProvider` too. – pbaris Sep 07 '15 at 08:06