Javascript AngularJS路由器应用程序冻结网页 首先,我通过更新CDN链接来修复空白页面。它能够加载header.html和footer.html而没有任何错误消息,但在尝试显示视图页面时会冻结。我不确定这是否与app.js或CDNhttps://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js链接
没有JS控制台错误 app.jsJavascript AngularJS路由器应用程序冻结网页 首先,我通过更新CDN链接来修复空白页面。它能够加载header.html和footer.html而没有任何错误消息,但在尝试显示视图页面时会冻结。我不确定这是否与app.js或CDNhttps://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js链接,javascript,angularjs,angular-ui-router,Javascript,Angularjs,Angular Ui Router,没有JS控制台错误 app.js var myApp= angular.module("myApp", ["ngRoute"]); myApp.config(function ($routeProvider, $locationProvider) { $locationProvider.hashPrefix(''); $routeProvider .when('/', { templateUrl: 'index.html' }) .when('/about', {
var myApp= angular.module("myApp", ["ngRoute"]);
myApp.config(function ($routeProvider, $locationProvider) {
$locationProvider.hashPrefix('');
$routeProvider
.when('/', {
templateUrl: 'index.html'
})
.when('/about', {
templateUrl: 'views/about.html'
})
.when('/contact', {
templateUrl: 'views/contact.html'
})
.when('/business', {
templateUrl: 'views/business-interpreting.html'
})
.when('/deafconsumers', {
templateUrl: 'views/deaf-consumers.html'
})
.when('/educational', {
templateUrl: 'views/educational-interpreting.html'
})
.when('/recruitment', {
templateUrl: 'views/interpreter-recruitment.html'
})
.when('/legal', {
templateUrl: 'views/legal-interpreting.html'
})
.when('/medical', {
templateUrl: 'views/medical-interpreting.html'
})
.when('/newclient', {
templateUrl: 'views/new-client.html'
})
.when('/request', {
templateUrl: 'views/request-interpreter.html'
})
.when('/vri', {
templateUrl: 'views/video-remote-interpreting.html'
});
});
链接
-
模块
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js"></script>
HTML
尝试如下配置$locationProvider
:
app.config(function($locationProvider) {
$locationProvider.hashPrefix('');
$locationProvider.html5Mode({
enabled: false,
requireBase: true
});
});
MyLink
其中给出:
希望有帮助。控制台中有错误吗?我该怎么做?打开浏览器的控制台。点击键盘上的F12模块代码在哪里?我正在显示未捕获的语法错误:意外标记。
在app.js第5行中,我的链接只是一个例子。。。。尝试配置$locationProviderI did,页面仍然为空,尝试添加“/#/”like“/#”!在locationProvider configmyApp.config(函数($routeProvider,$locationProvider){$locationProvider.hashPrefix(“”);$locationProvider.html5Mode({enabled:true,requireBase:true})中,将href链接和开关启用为true之前的medical'
-这就是我所做的,更新链接后仍然是空白页面。/#!
<!-- Header section -->
<div ng-include="'views/header.html'"></div> <--- loads just fine, but froze.
<!-- Views section -->
<div ng-view></div> <---------- it froze the webpage
<!-- Footer section -->
<div ng-include="'views/footer.html'"></div> <--- loads just fine, but froze.
app.config(function($locationProvider) {
$locationProvider.hashPrefix('');
$locationProvider.html5Mode({
enabled: false,
requireBase: true
});
});