테스트 사이트 - 개발 중인 베타 버전입니다

AngularJS Routing

· 8년 전 · 1178
AngularJS Routing

이 ngRoute모듈은 응용 프로그램이 단일 페이지 응용 프로그램이되도록 도와줍니다.

Angular에서 라우팅이란 무엇입니까?
응용 프로그램의 다른 페이지로 이동하려고하지만 페이지를 다시로드하지 않고 응용 프로그램을 SPA (단일 페이지 응용 프로그램)로 만들려면 해당 ngRoute모듈을 사용할 수 있습니다 .

ngRoute모듈 경로 전체 응용 프로그램을 다시로드하지 않고 다른 페이지로 응용 프로그램입니다.

예:
"red.htm", "green.htm"및 "blue.htm"으로 이동하십시오.

<body ng-app="myApp">

<p><a href="#/!">Main</a></p>

<a href="#!red">Red</a>
<a href="#!green">Green</a>
<a href="#!blue">Blue</a>

<div ng-view></div>

<script>
var app = angular.module("myApp", ["ngRoute"]);
app.config(function($routeProvider) {
$routeProvider
.when("/", {
templateUrl : "main.htm"
})
.when("/red", {
templateUrl : "red.htm"
})
.when("/green", {
templateUrl : "green.htm"
})
.when("/blue", {
templateUrl : "blue.htm"
});
});
</script>
</body>

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

게시글 목록

번호 제목
1266
1265
1264
1263
1262
1261
1260
1259
1258
1257
1256
jQuery Mobile Button Refresh()
1255
1254
1253
1252
1251
1250
1249
1248
jQuery Mobile Button Widget 1
1247
jQuery Mobile Checkbox 속성
1246
jQuery Mobile Button 속성
1245
jQuery Mobile vmouseup event
1244
jQuery Mobile vmouseover event
1243
jQuery Mobile vmouseout event
1242
jQuery Mobile vmousemove event
1241
jQuery Mobile vmousedown event
1240
jQuery Mobile vmousecancel event
1239
jQuery Mobile vclick event
1238
jQuery Mobile updatelayout event
1237