【发布时间】:2015-11-30 07:25:56
【问题描述】:
我正在 Microsoft Edge 上测试我的应用程序并引发此错误:
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
【问题讨论】:
-
logoutPage指令是什么样的? -
我了解到您使用的是常规的 $routeProvider。如果可能,我强烈建议使用 ui-router 尝试此功能:github.com/angular-ui/ui-router。去年 ng-conf 的 Angular 团队暗示每个人都应该使用 ui-router(这是他们将为 Angular 2 建模的东西)。这可能会停止您使用 ng-view 的需要,正如 Fabrice 建议的那样,这可能会导致您的 SyntaxError。
-
@Claies 所说的,发布您的注销页面和应用程序管理指令模板
-
@Dakky,请发布您的指令。此外,小提琴/掠夺会有所帮助。
标签: angularjs angularjs-directive angularjs-ng-click microsoft-edge ng-view