88 lines
1.1 KiB
Plaintext
88 lines
1.1 KiB
Plaintext
|
|
p.location-badge.
|
|
exported from <a href="/angular2/router.html">angular2/router</a>
|
|
defined in <a href="https://github.com/angular/angular/tree/master/modules/angular2/src/router/router_link.js#L36">angular2/src/router/router_link.js (line 36)</a>
|
|
|
|
:markdown
|
|
The RouterLink directive lets you link to specific parts of your app.
|
|
|
|
|
|
Consider the following route configuration:
|
|
|
|
```
|
|
@RouteConfig({
|
|
path: '/user', component: UserCmp, alias: 'user'
|
|
});
|
|
class MyComp {}
|
|
```
|
|
|
|
When linking to a route, you can write:
|
|
|
|
```
|
|
<a router-link="user">link to user component</a>
|
|
```
|
|
|
|
.l-main-section
|
|
h2 Members
|
|
.l-sub-section
|
|
h3 constructor
|
|
|
|
|
|
pre.prettyprint
|
|
code.
|
|
constructor(elementRef:ElementRef, router:Router)
|
|
|
|
:markdown
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 params
|
|
|
|
|
|
pre.prettyprint
|
|
code.
|
|
params(changes)
|
|
|
|
:markdown
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 route
|
|
|
|
|
|
pre.prettyprint
|
|
code.
|
|
route(changes)
|
|
|
|
:markdown
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 updateHref
|
|
|
|
|
|
pre.prettyprint
|
|
code.
|
|
updateHref()
|
|
|
|
:markdown
|
|
|
|
|
|
|
|
|
|
|
|
|