From 0f5ea46590ca050dc88c7842c0bee3cd9527c014 Mon Sep 17 00:00:00 2001
From: Kathy Walrath The hero's birthday is {{ birthday | date }} The hero's birthday is {{ birthday | date:"MM/dd/yy" }}
+ The chained hero's birthday is
+ {{ birthday | date | uppercase}}
+
+ The chained hero's birthday is
+ {{ birthday | date:'fullDate' | uppercase}}
+
+ The chained hero's birthday is
+ {{ ( birthday | date:'fullDate' ) | uppercase}}
+
- The chained hero's birthday is
- {{ birthday | date | uppercase}}
-
+
+
+
+
+Hero Birthday v.2
+
+
+
+
+
+
- The chained hero's birthday is - {{ ( birthday | date:'fullDate' ) | uppercase}} -
-''') -class ChainedPipes { - DateTime birthday = new DateTime(1988, 4, 15); // April 15, 1988 -} diff --git a/public/docs/_examples/pipes/dart/lib/exponential_strength_pipe.dart b/public/docs/_examples/pipes/dart/lib/exponential_strength_pipe.dart index d503d46038..b84297950c 100644 --- a/public/docs/_examples/pipes/dart/lib/exponential_strength_pipe.dart +++ b/public/docs/_examples/pipes/dart/lib/exponential_strength_pipe.dart @@ -1,5 +1,3 @@ -library pipes_examples.exponential_strength_pipe; - import 'dart:math' as math; import 'package:angular2/angular2.dart'; @@ -17,7 +15,7 @@ import 'package:angular2/angular2.dart'; @Pipe(name: 'exponentialStrength') @Injectable() -class ExponentialStrengthPipe { +class ExponentialStrengthPipe extends PipeTransform { transform(dynamic value, [ListMessage: {{delayedMessage | async}}
-''') -class MyHero { +@Component( + selector: 'hero-message', template: 'Message: {{delayedMessage | async}}') +class HeroAsyncMessageComponent { FutureThe hero's birthday is {{ birthday | date:format }}
- -''') -class HeroBirthday { - DateTime birthday = new DateTime(1988, 4, 15); // April 15, 1988 - String format = 'shortDate'; - String nextFormat = 'fullDate'; - - toggleFormat() { - var next = this.format; - format = this.nextFormat; - nextFormat = next; - } -} diff --git a/public/docs/_examples/pipes/dart/lib/hero_birthday1_component.dart b/public/docs/_examples/pipes/dart/lib/hero_birthday1_component.dart new file mode 100644 index 0000000000..4b8f3a33f2 --- /dev/null +++ b/public/docs/_examples/pipes/dart/lib/hero_birthday1_component.dart @@ -0,0 +1,10 @@ +import 'package:angular2/angular2.dart'; + +@Component( + selector: 'hero-birthday', + template: ''' +The hero's birthday is {{ birthday | date }}
+ ''') +class HeroBirthday { + DateTime birthday = new DateTime(1988, 4, 15); // April 15, 1988 +} diff --git a/public/docs/_examples/pipes/dart/lib/hero_birthday2_component.dart b/public/docs/_examples/pipes/dart/lib/hero_birthday2_component.dart new file mode 100644 index 0000000000..032888080e --- /dev/null +++ b/public/docs/_examples/pipes/dart/lib/hero_birthday2_component.dart @@ -0,0 +1,19 @@ +import 'package:angular2/angular2.dart'; + +@Component( + selector: 'hero-birthday', + template: ''' +The hero's birthday is {{ birthday | date:format }}
+ + ''') +class HeroBirthday { + DateTime birthday = new DateTime(1988, 4, 15); // April 15, 1988 + + bool toggle = true; + + get format => toggle ? 'shortDate' : 'fullDate'; + + void toggleFormat() { + toggle = !toggle; + } +} diff --git a/public/docs/_examples/pipes/dart/lib/hero_list_component.dart b/public/docs/_examples/pipes/dart/lib/hero_list_component.dart new file mode 100644 index 0000000000..50ae1a5bf1 --- /dev/null +++ b/public/docs/_examples/pipes/dart/lib/hero_list_component.dart @@ -0,0 +1,19 @@ +import 'package:angular2/angular2.dart'; + +import 'fetch_json_pipe.dart'; + +@Component( + selector: 'hero-list', + template: ''' +Heroes as JSON: + {{'heroes.json' | fetch | json}} +
+''', + pipes: const [FetchJsonPipe]) +class HeroListComponent {} diff --git a/public/docs/_examples/pipes/dart/lib/heroes_list.dart b/public/docs/_examples/pipes/dart/lib/heroes_list.dart deleted file mode 100644 index 8480818825..0000000000 --- a/public/docs/_examples/pipes/dart/lib/heroes_list.dart +++ /dev/null @@ -1,12 +0,0 @@ -library pipe_examples.heroes_list; - -import 'package:angular2/angular2.dart'; -import 'package:pipe_examples/fetch_json_pipe.dart'; - -@Component(selector: 'heroes-list') -@View( - template: ''' -Heroes: {{'heroes.json' | fetch | json}}
-''', - pipes: const [FetchJsonPipe]) -class HeroesList {} diff --git a/public/docs/_examples/pipes/dart/lib/power_boost_calculator.dart b/public/docs/_examples/pipes/dart/lib/power_boost_calculator.dart index 05a4745516..1d7f9558cd 100644 --- a/public/docs/_examples/pipes/dart/lib/power_boost_calculator.dart +++ b/public/docs/_examples/pipes/dart/lib/power_boost_calculator.dart @@ -1,21 +1,21 @@ -library pipe_examples.power_boost_calculator; - import 'package:angular2/angular2.dart'; -import 'package:pipe_examples/exponential_strength_pipe.dart'; -@Component(selector: 'power-boost-calculator') -@View( +import 'exponential_strength_pipe.dart'; + +@Component( + selector: 'power-boost-calculator', template: '''Super Hero Power: {{power | exponentialStrength: factor}}
''', pipes: const [ExponentialStrengthPipe], - directives: const [FORM_DIRECTIVES]) + directives: const [COMMON_DIRECTIVES]) class PowerBoostCalculator { - int power = 5; - int factor = 1; + // XXX: These should be ints, but that causes exceptions in checked mode. + String power = '5'; + String factor = '1'; } diff --git a/public/docs/_examples/pipes/dart/lib/power_booster.dart b/public/docs/_examples/pipes/dart/lib/power_booster.dart index 415a8e58ff..194abe1b0c 100644 --- a/public/docs/_examples/pipes/dart/lib/power_booster.dart +++ b/public/docs/_examples/pipes/dart/lib/power_booster.dart @@ -1,12 +1,13 @@ -library pipe_examples.power_booster; - import 'package:angular2/angular2.dart'; -import 'package:pipe_examples/exponential_strength_pipe.dart'; +import 'exponential_strength_pipe.dart'; -@Component(selector: 'power-booster') -@View( +@Component( + selector: 'power-booster', template: ''' -Super power boost: {{2 | exponentialStrength: 10}}
++ Super power boost: {{2 | exponentialStrength: 10}} +
''', pipes: const [ExponentialStrengthPipe]) class PowerBooster {} diff --git a/public/docs/_examples/pipes/dart/pubspec.yaml b/public/docs/_examples/pipes/dart/pubspec.yaml index 3e9fbacc85..603fb8b68d 100644 --- a/public/docs/_examples/pipes/dart/pubspec.yaml +++ b/public/docs/_examples/pipes/dart/pubspec.yaml @@ -2,8 +2,10 @@ name: pipe_examples description: Pipes Example version: 0.0.1 dependencies: - angular2: 2.0.0-alpha.45 + angular2: 2.0.0-beta.3 browser: ^0.10.0 transformers: - angular2: + platform_directives: 'package:angular2/src/common/directives.dart#CORE_DIRECTIVES' + platform_pipes: 'package:angular2/common.dart#COMMON_PIPES' entry_points: web/main.dart diff --git a/public/docs/_examples/pipes/dart/web/heroes.json b/public/docs/_examples/pipes/dart/web/heroes.json index 6248df4575..436b220d53 100644 --- a/public/docs/_examples/pipes/dart/web/heroes.json +++ b/public/docs/_examples/pipes/dart/web/heroes.json @@ -1,17 +1,6 @@ [ - { - "id":1, - "firstName":"Eenie", - "lastName":"Toe" - }, - { - "id":2, - "firstName":"Meenie", - "lastName":"Toe" - }, - { - "id":3, - "firstName":"Miny", - "lastName":"Toe" - } + {"name": "Windstorm"}, + {"name": "Bombasto"}, + {"name": "Magneto"}, + {"name": "Tornado"} ] diff --git a/public/docs/_examples/pipes/dart/web/index.html b/public/docs/_examples/pipes/dart/web/index.html index 26d8eeebd9..190cd7df3e 100644 --- a/public/docs/_examples/pipes/dart/web/index.html +++ b/public/docs/_examples/pipes/dart/web/index.html @@ -1,17 +1,16 @@ -