ng-view not working on Microsoft Edge
Asked Answered
G

2

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: https://mcmap.net/q/48825/-how-to-log-out-user-from-web-site-using-basic-authentication

Griswold answered 4/9, 2015 at 7:56 Comment(4)
what does the logoutPage directive look like?Uproarious
I understand you are using the regular $routeProvider. If possible, I would highly suggest attempting this functionality using ui-router: 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.Latinalatinate
What @Uproarious said, post your logout-page and application-manage directive templatesToxicant
@Dakky, please post your directives. Additionally, a fiddle/plunder would help.Masbate
V
-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'**
Vinnie answered 14/9, 2015 at 13:36 Comment(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.Kweisui
A
-5

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

ng-app="XYZManagementApp"
Albric answered 10/9, 2015 at 9:55 Comment(1)
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.Uproarious

© 2022 - 2024 — McMap. All rights reserved.