11

我测试我对微软Edge应用程序,它抛出这个错误:NG-视图不工作的微软边缘

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

在我的索引:

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

对于第一种情况:'<application-manage></application-manage>'它工作正常。但是当我点击注销。它引发错误:

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

谢谢大家。解决这个问题,这是因为这样我使用基本身份验证:

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); 
      }); 

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

+1

logoutPage指令是什么样的? – Claies

+0

我知道你使用的是常规的$ routeProvider。如果可能的话,我会强烈建议使用ui-router尝试这个功能:https://github.com/angular-ui/ui-router。去年在ng-conf的Angular团队暗示每个人都应该使用ui-router(这是他们将在Angular 2之后建模的)。这可能会阻止您使用ng-view,正如Fabrice所建议的那样,可能会导致您的SyntaxError。 –

+0

@Claies说什么,发布您的注销页面和应用程序管理指令模板 – Beyers

回答

-5

建议在这里,你可以请提供姓名,以HTML如下应用程序:

ng-app="XYZManagementApp" 
+0

我非常怀疑这会起作用,甚至不清楚这是从哪里来的,因为他们从未在其样本中列出ng-app。 – Claies

-1
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'** 
+0

我觉得好像不太可能解决指定的问题,因为它包含错误,使得'$ routeProvider'与'$ stateProvider'不同,'$ stateProvider'是'ui-router'提供的附加组件该操作没有指定用于此特定实现。 – Matt

相关问题