diff --git a/public/docs/_examples/displaying-data/dart/lib/app_component.dart b/public/docs/_examples/displaying-data/dart/lib/app_component.dart new file mode 100644 index 0000000000..82f84d163e --- /dev/null +++ b/public/docs/_examples/displaying-data/dart/lib/app_component.dart @@ -0,0 +1,43 @@ +// #docplaster +// #docregion final +library displaying_data.app_component; + +// #docregion imports +import 'package:angular2/angular2.dart'; +// #enddocregion imports +import 'package:displaying_data/hero.dart'; + +final List _heroes = [ + new Hero(1, 'Windstorm'), + new Hero(13, 'Bombasto'), + new Hero(15, 'Magneta'), + new Hero(20, 'Tornado') +]; + +@Component( + selector: 'my-app', + template: ''' +

{{title}}

+

My favorite hero is: {{myHero.name}}

+

Heroes:

+ + +

There are many heroes!

+ +''') +class AppComponent { + String title = 'Tour of Heroes'; + List heroes = _heroes; + Hero myHero = _heroes[0]; +} +//#enddocregion final +/* +// #docregion final + +bootstrap(AppComponent); +//#enddocregion final +*/ diff --git a/public/docs/_examples/displaying-data/dart/lib/app_component_1.dart b/public/docs/_examples/displaying-data/dart/lib/app_component_1.dart new file mode 100644 index 0000000000..3643da7564 --- /dev/null +++ b/public/docs/_examples/displaying-data/dart/lib/app_component_1.dart @@ -0,0 +1,17 @@ +// #docregion +library displaying_data.app_component_1; + +import 'package:angular2/angular2.dart'; + +@Component( + selector: 'my-app', +// #docregion template + template: ''' +

{{title}}

+

My favorite hero is: {{myHero}}

''' +// #enddocregion template + ) +class AppComponent { + String title = 'Tour of Heroes'; + String myHero = 'Windstorm'; +} diff --git a/public/docs/_examples/displaying-data/dart/lib/app_component_2.dart b/public/docs/_examples/displaying-data/dart/lib/app_component_2.dart new file mode 100644 index 0000000000..5c3b3bc633 --- /dev/null +++ b/public/docs/_examples/displaying-data/dart/lib/app_component_2.dart @@ -0,0 +1,39 @@ +// #docregion +library displaying_data.app_component_2; + +// #docregion imports +import 'package:angular2/angular2.dart'; + +// #enddocregion imports + +@Component( + selector: 'my-app', +// #docregion template + template: ''' +

{{title}}

+

My favorite hero is: {{myHero}}

+

Heroes:

+''' +// #enddocregion template + ) +// #docregion mock-heroes +const List _heroes = const [ + 'Windstorm', + 'Bombasto', + 'Magneta', + 'Tornado' +]; + +class AppComponent { + String title = 'Tour of Heroes'; + List heroes = _heroes; + String myHero = _heroes[0]; +} +// #enddocregion mock-heroes +// #enddocregion diff --git a/public/docs/_examples/displaying-data/dart/lib/app_component_3.dart b/public/docs/_examples/displaying-data/dart/lib/app_component_3.dart new file mode 100644 index 0000000000..c8c31fce60 --- /dev/null +++ b/public/docs/_examples/displaying-data/dart/lib/app_component_3.dart @@ -0,0 +1,42 @@ +// #docregion +library displaying_data.app_component_3; + +// #docregion imports +import 'package:angular2/angular2.dart'; +// #enddocregion imports +// #docregion import-hero +import 'package:displaying_data/hero.dart'; + +// #enddocregion import-hero + +@Component( + selector: 'my-app', +// #docregion template + template: ''' +

{{title}}

+

My favorite hero is: {{myHero.name}}

+

Heroes:

+
    +
  • + {{ hero.name }} +
  • +
''' +// #enddocregion template + ) +// #docregion heroes +final List _heroes = [ + new Hero(1, 'Windstorm'), + new Hero(13, 'Bombasto'), + new Hero(15, 'Magneta'), + new Hero(20, 'Tornado') +]; + +// #enddocregion heroes +// #docregion class +class AppComponent { + String title = 'Tour of Heroes'; + List heroes = _heroes; + Hero myHero = _heroes[0]; +} +// #enddocregion class +// #enddocregion diff --git a/public/docs/_examples/displaying-data/dart/lib/app_ctor_component.dart b/public/docs/_examples/displaying-data/dart/lib/app_ctor_component.dart new file mode 100644 index 0000000000..b1d0ba336d --- /dev/null +++ b/public/docs/_examples/displaying-data/dart/lib/app_ctor_component.dart @@ -0,0 +1,21 @@ +// #docregion +library displaying_data.app_ctor_component; + +import 'package:angular2/angular2.dart'; + +@Component( + selector: 'my-app-ctor', + template: ''' +

{{title}} [Ctor version]

+

My favorite hero is: {{myHero}}

''') +// #docregion app-ctor +class AppCtorComponent { + String title; + String myHero; + + AppCtorComponent() { + this.title = 'Tour of Heroes'; + this.myHero = 'Windstorm'; + } +} +// #enddocregion app-ctor diff --git a/public/docs/_examples/displaying-data/dart/lib/hero.dart b/public/docs/_examples/displaying-data/dart/lib/hero.dart new file mode 100644 index 0000000000..3fb139db73 --- /dev/null +++ b/public/docs/_examples/displaying-data/dart/lib/hero.dart @@ -0,0 +1,12 @@ +// #docregion +library displaying_data.hero; + +class Hero { + // #docregion id-parameter + int number; + // #enddocregion id-parameter + String name; + + Hero(this.number, this.name); +} +// #enddocregion diff --git a/public/docs/_examples/displaying-data/dart/pubspec.yaml b/public/docs/_examples/displaying-data/dart/pubspec.yaml new file mode 100644 index 0000000000..b79474da42 --- /dev/null +++ b/public/docs/_examples/displaying-data/dart/pubspec.yaml @@ -0,0 +1,11 @@ +name: displaying_data +description: Displaying Data Example +version: 0.0.1 +dependencies: + angular2: 2.0.0-beta.0 + browser: ^0.10.0 +transformers: +- angular2: + platform_directives: 'package:angular2/src/common/directives.dart#CORE_DIRECTIVES' + entry_points: web/main.dart + diff --git a/public/docs/_examples/displaying-data/dart/web/index.html b/public/docs/_examples/displaying-data/dart/web/index.html new file mode 100644 index 0000000000..6efa48834c --- /dev/null +++ b/public/docs/_examples/displaying-data/dart/web/index.html @@ -0,0 +1,14 @@ + + + + + Displaying Data + + + + + + + + + diff --git a/public/docs/_examples/displaying-data/dart/web/main.dart b/public/docs/_examples/displaying-data/dart/web/main.dart new file mode 100644 index 0000000000..73837a7180 --- /dev/null +++ b/public/docs/_examples/displaying-data/dart/web/main.dart @@ -0,0 +1,14 @@ +// #docregion +import 'package:angular2/bootstrap.dart'; +//import 'package:displaying_data/app_component_1.dart' as v1; +//import 'package:displaying_data/app_component_2.dart' as v2; +//import 'package:displaying_data/app_component_3.dart' as v3; +import 'package:displaying_data/app_component.dart'; + +main() { +// pick one +// bootstrap(v1.AppComponent); +// bootstrap(v2.AppComponent); +// bootstrap(v3.AppComponent); + bootstrap(AppComponent); +}