Also update dart_to_js_script_rewriter dependency to ^1.0.1, and change most angular2.dart imports to be core.dart instead. The pipes example broke without the angular2.dart import, so I let it be. The server-communication sample has never worked for me, so I changed it but might have broken it further. closes #1007
33 lines
645 B
Dart
33 lines
645 B
Dart
// #docregion
|
|
import 'package:angular2/core.dart';
|
|
|
|
import 'hero.dart';
|
|
|
|
final List<Hero> _heroes = [
|
|
new Hero(1, 'Windstorm'),
|
|
new Hero(13, 'Bombasto'),
|
|
new Hero(15, 'Magneta'),
|
|
new Hero(20, 'Tornado')
|
|
];
|
|
|
|
@Component(
|
|
selector: 'my-app',
|
|
template: '''
|
|
<h1>{{title}}</h1>
|
|
<h2>My favorite hero is: {{myHero.name}}</h2>
|
|
<p>Heroes:</p>
|
|
<ul>
|
|
<li *ngFor="#hero of heroes">
|
|
{{ hero.name }}
|
|
</li>
|
|
</ul>
|
|
// #docregion message
|
|
<p *ngIf="heroes.length > 3">There are many heroes!</p>
|
|
// #enddocregion message
|
|
''')
|
|
class AppComponent {
|
|
String title = 'Tour of Heroes';
|
|
List<Hero> heroes = _heroes;
|
|
Hero myHero = _heroes[0];
|
|
}
|