Posts [Javascript] Routie
Post
Cancel

[Javascript] Routie

Network

- Routie 공식 사이트

- 일반 사용법

1
2
3
routie('users', function() {
    //this gets called when hash == #users
});

- 응용 사용법

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
routie({
    'users': function() {

    },
    'about': function() {
    }
});

// Routie 정의
routie('users/:name', function(name) {
    //name == 'bob';
});

// Routie 사용
routie('users/bob');

// Routie 사용 시 Anchor 태그로 URL 뒤에 index.jsp#bob 이렇게 붙는다

// Parameter 옵션

routie('users/?:name', function(name) {
    //name == undefined
    //then
    //name == bob
});

routie('users/');

routie('users/bob');

// wilecard

routie('users/*', function() {
});

routie('users/12312312');

// catch all:

routie('*', function() {
});

routie('anything');
저자는 이 저작물에 대해 CC BY-NC 4.0 라이선스를 가집니다.