12

I am testing my application on Microsoft Edge and it throws this error:

    app.config(
        function ($routeProvider) {
      $routeProvider.
          when('/logout', {
              template: '<logout-page></logout-page>'
          })
          .when('/', {
              template: '<application-manage></application-manage>'
          })
});

In my index:

<body  style="height: 100%">
<div class='main-div' style="height: 100%;" ng-view ng-class="slide">Loading....</div>
</body>

With the first case: '<application-manage></application-manage>' it's working normal. But when I click logout. It throws error:

SyntaxError <div class="main-div ng-scope" style="height: 100%" ng-class="slide" ng-view="">

Thanks everyone. The problem is solved, it's because of the way I am using basic authentication:

jQuery.ajax({
              type: "GET",
              url: logoutURL ,
              async: true,
              username: fakeUser,
              password: fakePassword,
              headers: {"Authorization": "Basic Authorization"}
          }).done(function () {
             console.log("Can not logout Basic Authentication in this browser");
         defer.resolve(true);
            }).fail(function () {
                console.log("You have successfully logged out!");
                defer.resolve(true);
           });

From: http://stackoverflow.com/questions/233507/how-to-log-out-user-from-web-site-using-basic-authentication

Le Dac Sy
  • 381
  • 3
  • 16
  • 1
    what does the `logoutPage` directive look like? – Claies Sep 09 '15 at 06:37
  • I understand you are using the regular $routeProvider. If possible, I would highly suggest attempting this functionality using ui-router: https://github.com/angular-ui/ui-router. The Angular team at ng-conf last year implied everyone should be using ui-router (it's what they will be modeling after for Angular 2). This may stop your need to use ng-view which, as Fabrice suggested, might be causing your SyntaxError. – Dan Keiger Sep 09 '15 at 13:57
  • What @Claies said, post your logout-page and application-manage directive templates – Beyers Sep 09 '15 at 22:38
  • @Dakky, please post your directives. Additionally, a fiddle/plunder would help. – Vipul Agarwal Sep 10 '15 at 07:53

2 Answers2

-2
Try:

   app.config(
        function ($routeProvider) {
      $stateProvider
                .state('/logout', {
url:'/logout',
              template: '<ui-view>'
          })
          .state('/', {
url:'/',
              template: '<ui-view>'
          })
});

You can Also use external html file, in this case use **templateUrl:'your file.html'**
krawdand
  • 1
  • 1
  • I feel as though is unlikely to solve the problem specified since it contains errors such that `$routeProvider` is not the same thing as `$stateProvider` and that `$stateProvider` is an additional component provided by `ui-router` which the op has not specified to be in use for this particular implementation. – Matt Sep 15 '15 at 19:54
-5

Suggestion here, can you please provide name to app as below in HTML:

ng-app="XYZManagementApp"
Omkara
  • 414
  • 4
  • 16
  • I highly doubt that this would work, and it's not even clear where this came from, since they never listed ng-app in their samples. – Claies Sep 10 '15 at 11:30