내가 Angular.js과 임 현재 아무것도는 AngularJS와 경로에 대한 HREF를 제공하는 방법
을 ngRoute에 대해 배우려고 노력하고 있지만 표시되지 않는 새로운 오전이 app.js 설정 파일
var app = angular.module('myApp',['ngRoute']);
// configure our routes
app.config(function($routeProvider) {
$routeProvider
// route for the home page
.when('/', {
templateUrl : 'index.html',
controller : 'mainController'
})
// route for the about page
.when('/about', {
templateUrl : 'bb.html',
controller : 'loginController'
})
// route for the contact page
.when('/contact', {
templateUrl : 'contact.html',
controller : 'contactController'
});
});
이에게 있습니다 주요 index.html을이다
<head>
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen" />
<link href="css/bootstrap-theme.min.css" rel="stylesheet" media="screen"/>
</head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.10/angular-route.min.js"></script>
<body ng-app="myApp">
<h1> User :{{user}}</h1>
<a href="#about">
about
</a>
<h1>User :{{user}}</h1>
</html></body>
</html>
<script src="app.js"></script>
<script src="mainController.js"></script>
<script src="loginController.js"></script>
이 내 컨트롤러입니다
//mainController.js
app.controller('mainController',function($scope, $http) {
$scope.user = "user";
});
//loginController.js
app.controller('loginController',function($scope, $http) {
$scope.user = "user";
});
이것은
노드 경로를 확인하기 때문에 대략 얻을 수 없다는 것을 나타냅니다. 약 href는 어떻게 제공해야합니까?
이 –
@DurgpalSingh http로 시도 : // localhost를 : 8080/# about..but의 나를 bb.html로 라우팅하지 않습니다. – MrRobot9
왜 여러 개의 body 태그가 있습니까? –