Angularjs ';角度路线.min.js“;错误显示在HTML页面上
我创建了index.html,如下所示:Angularjs ';角度路线.min.js“;错误显示在HTML页面上,angularjs,Angularjs,我创建了index.html,如下所示: <html lang="en" ng-app="bootProject" > <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <
<html lang="en" ng-app="bootProject" >
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>SASS / Home
</title>
<script src="../../node_modules/angular/angular.min.js"></script>
<script src="../../node_modules/angular-route/angular-route.min.js"></script>
<!-- Bootstrap core CSS -->
<link href="../../node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../../dist/css/main.css" rel="stylesheet">
<!-- Custom styles for font-awesome css -->
<link href="../../node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
<div ng-view></div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../../node_modules/jquery/dist/jquery.js"></script>
<script src="../../node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
angular-route.min.js
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../javascript/main.js"></script>
<script src="//localhost:35729/livereload.js"></script>
</body>
</html>
当我在localhost/dist中打开我的项目时,它只显示了一行“angular route.min.js”,但当我在localhost/src中打开它时,它显示了正确的页面,但我仍然可以在log.html页面中看到该行
<ul class="nav navbar-nav">
<li class="active"><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#service">Services</a></li>
<li><a href="#blog">Blog</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
<ul class="nav navbar-nav pull-right">
<li><a href="#register">Register</a></li>
<li><a href="#log">Login</a></li>
<div><ng-view></div>
</ul>
</div>
请让我知道我的错误是什么 我看不到
。否则,在您的路由中会出现。您应该使用。否则
捕获与您指定的路由不匹配的路由
例如,您可以使用。否则({redirectTo:'/home'})代码>不要将代码作为图像发布。请将您的代码直接作为文本通过编辑您的问题。这不是一个错误与<代码>角.min js<代码>,它只是显示,因为,由于某种原因,您有在正文脚本标签中间的正文。您没有与您正在浏览的URL相匹配的路由,也没有“<代码>”,否则,因此<代码> NG视图元素仍然是空的。我正在浏览log.html页面:好吧,即使在这条路线上,文本仍然在正文中,在ng视图
之外。此外,如果您的URL中必须包含/dist/templates
,则确实存在一些问题。路由器不是这样工作的。你的路线应该是。没有/dist/templates/
,也没有.html
。我的正文中没有它自己显示的文本!当我点击元素中的那一行时,我看到这一行“它说它来自引导!这就是那一行出现的原因吗?”!?
// Module
var weatherApp = angular.module('bootProject',['ngRoute']);
// Route
weatherApp.config(function($routeProvider){
$routeProvider
.when('/home',{
templateUrl:'http://localhost:1337/dist/templates/home.html',
controller: 'homeController'
})
.when('/log',{
templateUrl:'http://localhost:1337/dist/templates/log.html',
controller: 'logController'
})
.when('/dashboard',{
templateUrl:'http://localhost:1337/dist/templates/home.html',
controller: 'dashboardController'
});
});
//Controllers
weatherApp.controller('logController', [ '$scope', '$location',function($scope,$location){
$scope.submit= function(){
var uname = $scope.username;
console.log(uname);
var pass = $scope.password;
if($scope.username =='admin' && $scope.password =='admin'){
$location.path("/dashboard");
}
};
}]);