AngularJS Routing - 무엇이 필요합니까?
AngularJS Routing - 무엇이 필요합니까?
응용 프로그램을 라우팅 할 수 있도록하려면 AngularJS Route 모듈을 포함해야합니다.
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js"></script>
그런 다음 ngRoute애플리케이션 모듈에 종속물로 추가해야합니다.
var app = angular.module("myApp", ["ngRoute"]);
이제 애플리케이션은를 제공하는 라우트 모듈에 액세스 할 수 $routeProvider있습니다.
을 사용 $routeProvider하여 애플리케이션에서 다른 경로를 구성하십시오.
app.config(function($routeProvider) {
$routeProvider
.when("/", {
templateUrl : "main.htm"
})
.when("/red", {
templateUrl : "red.htm"
})
.when("/green", {
templateUrl : "green.htm"
})
.when("/blue", {
templateUrl : "blue.htm"
});
});
어디로 가나 요?
응용 프로그램에는 라우팅에서 제공하는 내용을 넣을 컨테이너가 필요합니다.
이 컨테이너가 ng-view지시어입니다.
ng-view응용 프로그램에 지시문 을 포함시키는 세 가지 다른 방법이 있습니다 .
예:
<div ng-view></div>
예:
<ng-view></ng-view>
예:
<div class="ng-view"></div>
응용 프로그램에는 하나의 ng-view지시문 만있을 수 있으며이 지시문은 경로에서 제공하는 모든보기에 대한 자리 표시 자입니다.
응용 프로그램을 라우팅 할 수 있도록하려면 AngularJS Route 모듈을 포함해야합니다.
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js"></script>
그런 다음 ngRoute애플리케이션 모듈에 종속물로 추가해야합니다.
var app = angular.module("myApp", ["ngRoute"]);
이제 애플리케이션은를 제공하는 라우트 모듈에 액세스 할 수 $routeProvider있습니다.
을 사용 $routeProvider하여 애플리케이션에서 다른 경로를 구성하십시오.
app.config(function($routeProvider) {
$routeProvider
.when("/", {
templateUrl : "main.htm"
})
.when("/red", {
templateUrl : "red.htm"
})
.when("/green", {
templateUrl : "green.htm"
})
.when("/blue", {
templateUrl : "blue.htm"
});
});
어디로 가나 요?
응용 프로그램에는 라우팅에서 제공하는 내용을 넣을 컨테이너가 필요합니다.
이 컨테이너가 ng-view지시어입니다.
ng-view응용 프로그램에 지시문 을 포함시키는 세 가지 다른 방법이 있습니다 .
예:
<div ng-view></div>
예:
<ng-view></ng-view>
예:
<div class="ng-view"></div>
응용 프로그램에는 하나의 ng-view지시문 만있을 수 있으며이 지시문은 경로에서 제공하는 모든보기에 대한 자리 표시 자입니다.
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 118 | jQuery Mobile | 8년 전 | 1352 | ||
| 117 | jQuery Mobile | 8년 전 | 1603 | ||
| 116 | jQuery Mobile | 8년 전 | 1833 | ||
| 115 | jQuery Mobile | 8년 전 | 1787 | ||
| 114 | jQuery Mobile | 8년 전 | 1976 | ||
| 113 | jQuery Mobile | 8년 전 | 1884 | ||
| 112 | jQuery Mobile | 8년 전 | 2492 | ||
| 111 | jQuery Mobile | 8년 전 | 1795 | ||
| 110 | jQuery Mobile | 8년 전 | 1589 | ||
| 109 | jQuery Mobile | 8년 전 | 1750 | ||
| 108 | jQuery Mobile | 8년 전 | 1974 | ||
| 107 | jQuery Mobile | 8년 전 | 1777 | ||
| 106 | jQuery Mobile | 8년 전 | 1456 | ||
| 105 | jQuery Mobile | 8년 전 | 1758 | ||
| 104 | jQuery Mobile | 8년 전 | 2440 | ||
| 103 | jQuery Mobile | 8년 전 | 1571 | ||
| 102 | jQuery Mobile | 8년 전 | 1512 | ||
| 101 | jQuery Mobile | 8년 전 | 1701 | ||
| 100 | jQuery Mobile | 8년 전 | 1930 | ||
| 99 | jQuery Mobile | 8년 전 | 1389 | ||
| 98 | jQuery Mobile | 8년 전 | 1410 | ||
| 97 | jQuery Mobile | 8년 전 | 1665 | ||
| 96 | jQuery Mobile | 8년 전 | 1316 | ||
| 95 | jQuery Mobile | 8년 전 | 1130 | ||
| 94 | jQuery Mobile | 8년 전 | 1533 | ||
| 93 | jQuery Mobile | 8년 전 | 1151 | ||
| 92 | jQuery Mobile | 8년 전 | 1574 | ||
| 91 | jQuery Mobile | 8년 전 | 1526 | ||
| 90 | jQuery Mobile | 8년 전 | 1691 | ||
| 89 | jQuery Mobile | 8년 전 | 1672 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기