Change `ngFor=“#…”` to `ngFor=“let…` in code. All are .dart files except for `app_component.html` which also has changes for: - `<inpuf var-foo…`> to `<input ref-foo…>` - `#docregion` tag name updates from var-foo to ref-foo. - Other misc updates to minimize diffs with TS version of file, whitespace differences were ignored. + Minor update to sync up Dart prose with TS prose. + Used https://github.com/angular/angular/wiki/Angular-2-Dart-Transformer#resol ved_identifiers to solve https://github.com/angular/angular.io/issues/1033 Guide/pipes not updated as it will be rolled back to beta.15 in PR #1220.
55 lines
1.3 KiB
Dart
55 lines
1.3 KiB
Dart
// #docregion
|
|
import 'package:angular2/core.dart';
|
|
|
|
import 'edit_item.dart';
|
|
import 'hero.dart';
|
|
import 'hero_card_component.dart';
|
|
import 'hero_editor_component.dart';
|
|
import 'heroes_service.dart';
|
|
|
|
@Component(
|
|
selector: 'heroes-list',
|
|
template: '''
|
|
<div>
|
|
<ul>
|
|
<li *ngFor="let editItem of heroes">
|
|
<hero-card
|
|
[hidden]="editItem.editing"
|
|
[hero]="editItem.item">
|
|
</hero-card>
|
|
<button
|
|
[hidden]="editItem.editing"
|
|
(click)="editItem.editing = true">
|
|
edit
|
|
</button>
|
|
<hero-editor
|
|
(saved)="onSaved(editItem, \$event)"
|
|
(canceled)="onCanceled(editItem)"
|
|
[hidden]="!editItem.editing"
|
|
[hero]="editItem.item">
|
|
</hero-editor>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
''',
|
|
directives: const [HeroCardComponent, HeroEditorComponent])
|
|
class HeroesListComponent {
|
|
List<EditItem<Hero>> heroes;
|
|
HeroesListComponent(HeroesService heroesService) {
|
|
heroes = heroesService
|
|
.getHeroes()
|
|
.map((Hero item) => new EditItem(item))
|
|
.toList();
|
|
}
|
|
|
|
onCanceled(EditItem<Hero> editItem) {
|
|
editItem.editing = false;
|
|
}
|
|
|
|
onSaved(EditItem<Hero> editItem, Hero updatedHero) {
|
|
editItem.item = updatedHero;
|
|
editItem.editing = false;
|
|
}
|
|
}
|
|
// #enddocregion
|