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.
		
			
				
	
	
		
			54 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
// #docregion
 | 
						|
import 'package:angular2/core.dart';
 | 
						|
 | 
						|
import 'logger_service.dart';
 | 
						|
import 'spy_directive.dart';
 | 
						|
 | 
						|
@Component(
 | 
						|
    selector: 'spy-parent',
 | 
						|
    template: '''
 | 
						|
    <div class="parent">
 | 
						|
      <h2>Spy Directive</h2>
 | 
						|
 | 
						|
      <input [(ngModel)]="newName" (keyup.enter)="addHero()">
 | 
						|
      <button (click)="addHero()">Add Hero</button>
 | 
						|
      <button (click)="reset()">Reset Heroes</button>
 | 
						|
 | 
						|
      <p></p>
 | 
						|
      <div *ngFor="let hero of heroes" mySpy class="heroes">
 | 
						|
      {{hero}}
 | 
						|
      </div>
 | 
						|
 | 
						|
      <h4>-- Spy Lifecycle Hook Log --</h4>
 | 
						|
      <div *ngFor="let msg of spyLog">{{msg}}</div>
 | 
						|
    </div>
 | 
						|
    ''',
 | 
						|
    styles: const [
 | 
						|
      '.parent {background: khaki; padding: 10px; margin:100px 8px}',
 | 
						|
      '.heroes {background: LightYellow; padding: 0 8px}'
 | 
						|
    ],
 | 
						|
    directives: const [Spy],
 | 
						|
    providers: const [LoggerService])
 | 
						|
class SpyParentComponent {
 | 
						|
  String newName = 'Herbie';
 | 
						|
  List<String> heroes = ['Windstorm', 'Magneta'];
 | 
						|
  List<String> spyLog;
 | 
						|
  LoggerService _logger;
 | 
						|
 | 
						|
  SpyParentComponent(this._logger) {
 | 
						|
    spyLog = _logger.logs;
 | 
						|
  }
 | 
						|
 | 
						|
  addHero() {
 | 
						|
    if (newName.trim().isNotEmpty) {
 | 
						|
      heroes.add(newName.trim());
 | 
						|
      newName = '';
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  reset() {
 | 
						|
    _logger.log('-- reset --');
 | 
						|
    heroes.clear();
 | 
						|
  }
 | 
						|
}
 |