angular-docs-cn/public/docs/_examples/pipes/dart/lib/hero_birthday2_component.dart
Patrice Chalin 3510f96620 docs(guide/pipes): follow-up to #1654 (#1769)
Mainly Dart-side review, following #1654:
- Updates to follow style guide
- Suites passed:
  public/docs/_examples/pipes/dart
- Suites failed (known issue - #1761):
  public/docs/_examples/pipes/ts
2016-06-28 08:22:53 -07:00

25 lines
562 B
Dart

// #docregion
import 'package:angular2/angular2.dart';
@Component(
selector: 'hero-birthday2',
// #docregion template
template: '''
<p>The hero's birthday is {{ birthday | date:format }}</p>
<button (click)="toggleFormat()">Toggle Format</button>
'''
// #enddocregion template
)
// #docregion class
class HeroBirthday2Component {
DateTime birthday = new DateTime(1988, 4, 15); // April 15, 1988
bool toggle = true;
get format => toggle ? 'shortDate' : 'fullDate';
void toggleFormat() {
toggle = !toggle;
}
}