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지시문 만있을 수 있으며이 지시문은 경로에서 제공하는 모든보기에 대한 자리 표시 자입니다.
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 88 | jQuery Mobile | 8년 전 | 1924 | ||
| 87 | jQuery Mobile | 8년 전 | 1910 | ||
| 86 | jQuery Mobile | 8년 전 | 1515 | ||
| 85 | jQuery Mobile | 8년 전 | 1825 | ||
| 84 | jQuery Mobile | 8년 전 | 1862 | ||
| 83 | jQuery Mobile | 8년 전 | 1873 | ||
| 82 | jQuery Mobile | 8년 전 | 1647 | ||
| 81 | jQuery Mobile | 8년 전 | 1366 | ||
| 80 | jQuery Mobile | 8년 전 | 1803 | ||
| 79 | jQuery Mobile | 8년 전 | 1355 | ||
| 78 | jQuery Mobile | 8년 전 | 1749 | ||
| 77 | jQuery Mobile | 8년 전 | 1776 | ||
| 76 | jQuery Mobile | 8년 전 | 1781 | ||
| 75 | jQuery Mobile | 8년 전 | 1398 | ||
| 74 | jQuery Mobile | 8년 전 | 1534 | ||
| 73 | jQuery Mobile | 8년 전 | 1243 | ||
| 72 | jQuery Mobile | 8년 전 | 1626 | ||
| 71 | jQuery Mobile | 8년 전 | 1617 | ||
| 70 | jQuery Mobile | 8년 전 | 1500 | ||
| 69 | jQuery Mobile | 8년 전 | 1506 | ||
| 68 | jQuery Mobile | 8년 전 | 2037 | ||
| 67 | jQuery Mobile | 8년 전 | 1313 | ||
| 66 | jQuery Mobile | 8년 전 | 1689 | ||
| 65 | jQuery Mobile | 8년 전 | 1183 | ||
| 64 | jQuery Mobile | 8년 전 | 1464 | ||
| 63 | jQuery Mobile | 8년 전 | 1650 | ||
| 62 | jQuery Mobile | 8년 전 | 1628 | ||
| 61 | jQuery Mobile | 8년 전 | 1873 | ||
| 60 | jQuery Mobile | 8년 전 | 1401 | ||
| 59 | jQuery Mobile | 8년 전 | 1958 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기