This repository was archived by the owner on Dec 4, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
public/docs/_examples/toh-5/dart/lib Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 4
4
import 'dart:async' ;
5
5
6
6
import 'package:angular2/core.dart' ;
7
+ // #docregion import-router
8
+ import 'package:angular2/router.dart' ;
9
+ // #enddocregion import-router
7
10
8
11
import 'hero.dart' ;
9
12
import 'hero_service.dart' ;
10
13
// #enddocregion imports
11
14
15
+ // #docregion metadata
12
16
@Component (
13
17
selector: 'my-dashboard' ,
14
18
// #docregion templateUrl
15
19
templateUrl: 'dashboard_component.html' ,
16
20
// #enddocregion templateUrl
17
21
// #docregion css
18
- styleUrls: const ['dashboard_component.css' ]
22
+ styleUrls: const ['dashboard_component.css' ],
19
23
// #enddocregion css
24
+ directives: const [ROUTER_DIRECTIVES ],
20
25
)
21
- // #docregion component
26
+ // #enddocregion metadata
27
+ // #docregion class, component
22
28
class DashboardComponent implements OnInit {
23
29
List <Hero > heroes;
24
30
25
31
// #docregion ctor
26
32
final HeroService _heroService;
27
33
28
34
DashboardComponent (this ._heroService);
29
-
30
35
// #enddocregion ctor
31
36
32
37
Future <Null > ngOnInit () async {
33
38
heroes = (await _heroService.getHeroes ()).skip (1 ).take (4 ).toList ();
34
39
}
35
40
}
36
- // #enddocregion component
Original file line number Diff line number Diff line change 2
2
< h3 > Top Heroes</ h3 >
3
3
< div class ="grid grid-pad ">
4
4
<!-- #docregion click -->
5
- < a *ngFor ="let hero of heroes " [routerLink] ="['/detail ', hero.id] " class ="col-1-4 ">
5
+ < a *ngFor ="let hero of heroes " [routerLink] ="['./HeroDetail ', {id: hero.id}] " class ="col-1-4 ">
6
6
<!-- #enddocregion click -->
7
7
< div class ="module hero ">
8
8
< h4 > {{hero.name}}</ h4 >
You can’t perform that action at this time.
0 commit comments