docs(dart): update sample code to be more uniform, use b2

closes #766
This commit is contained in:
Kathy Walrath 2016-01-27 15:51:50 -08:00
parent e258e0f346
commit a7826ee44c
44 changed files with 107 additions and 91 deletions

View File

@ -1,9 +1,8 @@
// #docregion
library developer_guide_intro.backend_service;
import 'package:angular2/angular2.dart';
import 'package:developer_guide_intro/logger_service.dart';
import 'package:developer_guide_intro/hero.dart';
import 'hero.dart';
import 'logger_service.dart';
@Injectable()
class BackendService {

View File

@ -1,6 +1,4 @@
// #docregion
library developer_guide_intro.hero;
class Hero {
static int _nextId = 1;
int id;

View File

@ -1,8 +1,7 @@
// #docregion
library developer_guide_intro.hero_detail_component;
import 'package:angular2/angular2.dart';
import 'package:developer_guide_intro/hero.dart';
import 'hero.dart';
@Component(selector: 'hero-detail', templateUrl: 'hero_detail_component.html')
class HeroDetailComponent {

View File

@ -1,10 +1,9 @@
// #docplaster
library developer_guide_intro.hero_list_component;
import 'package:angular2/angular2.dart';
import 'package:developer_guide_intro/hero.dart';
import 'package:developer_guide_intro/hero_detail_component.dart';
import 'package:developer_guide_intro/hero_service.dart';
import 'hero.dart';
import 'hero_detail_component.dart';
import 'hero_service.dart';
// #docregion metadata
// #docregion providers

View File

@ -1,9 +1,8 @@
library developer_guide_intro.hero_service;
import 'package:angular2/angular2.dart';
import 'package:developer_guide_intro/hero.dart';
import 'package:developer_guide_intro/backend_service.dart';
import 'package:developer_guide_intro/logger_service.dart';
import 'backend_service.dart';
import 'hero.dart';
import 'logger_service.dart';
// #docregion class
@Injectable()

View File

@ -1,6 +1,4 @@
// #docregion
library developer_guide_intro.logger_service;
import 'dart:html';
import 'package:angular2/angular2.dart';

View File

@ -1,10 +1,15 @@
# #docregion
name: developer_guide_intro
description: Developer Guide Intro
version: 0.0.1
environment:
sdk: '>=1.13.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.0
angular2: 2.0.0-beta.2
browser: ^0.10.0
dart_to_js_script_rewriter: ^0.1.0
transformers:
- angular2:
platform_directives: 'package:angular2/src/common/directives.dart#CORE_DIRECTIVES'
platform_directives: 'package:angular2/common.dart#CORE_DIRECTIVES'
entry_points: web/main.dart
- dart_to_js_script_rewriter

View File

@ -1,9 +1,9 @@
// #docregion
import 'package:angular2/bootstrap.dart';
import 'package:developer_guide_intro/backend_service.dart';
import 'package:developer_guide_intro/hero_list_component.dart';
import 'package:developer_guide_intro/hero_service.dart';
import 'package:developer_guide_intro/logger_service.dart';
import 'package:developer_guide_intro/hero_list_component.dart';
main() {
// #docregion bootstrap

View File

@ -1,8 +1,7 @@
// #docregion
library attribute_directives.app_component;
import 'package:angular2/angular2.dart';
import 'package:attribute_directives/highlight_directive.dart';
import 'highlight_directive.dart';
@Component(
selector: 'my-app',

View File

@ -1,7 +1,5 @@
// #docplaster
// #docregion full
library attribute_directives.highlight_directive;
import 'package:angular2/angular2.dart';
@Directive(selector: '[my-highlight]', host: const {

View File

@ -1,6 +1,4 @@
// #docregion
library attribute_directives.highlight_directive;
import 'package:angular2/angular2.dart';
@Directive(selector: '[my-highlight]',

View File

@ -1,10 +1,15 @@
# #docregion
name: attribute_directives
description: Attribute Directives
description: Attribute directives example
version: 0.0.1
environment:
sdk: '>=1.13.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.0
angular2: 2.0.0-beta.2
browser: ^0.10.0
dart_to_js_script_rewriter: ^0.1.0
transformers:
- angular2:
platform_directives: 'package:angular2/src/common/directives.dart#CORE_DIRECTIVES'
platform_directives: 'package:angular2/common.dart#CORE_DIRECTIVES'
entry_points: web/main.dart
- dart_to_js_script_rewriter

View File

@ -8,6 +8,6 @@
<script defer src="packages/browser/dart.js"></script>
</head>
<body>
<my-app>loading...</my-app>
<my-app>Loading...</my-app>
</body>
</html>

View File

@ -1,6 +1,4 @@
// #docregion all
library hero_form.hero;
class Hero {
int number;
String name;

View File

@ -1,10 +1,9 @@
// #docplaster
// #docregion
// #docregion no-todo
library hero_form.hero_form_component;
import 'package:angular2/angular2.dart';
import 'package:hero_form/hero.dart';
import 'hero.dart';
const List<String> _powers = const [
'Really Smart',

View File

@ -1,6 +1,4 @@
// #docregion
library hero_form.hero_form_component;
import 'package:angular2/angular2.dart';
@Component(selector: 'hero-form', template: 'Hero form will go here')

View File

@ -2,13 +2,16 @@
name: hero_form
description: Form example
version: 0.0.1
environment:
sdk: '>=1.13.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.0
angular2: 2.0.0-beta.2
browser: ^0.10.0
dart_to_js_script_rewriter: ^0.1.0
transformers:
- angular2:
platform_directives:
- 'package:angular2/common.dart#CORE_DIRECTIVES'
- 'package:angular2/common.dart#FORM_DIRECTIVES'
entry_points: web/main.dart
- dart_to_js_script_rewriter

View File

@ -1,6 +1,7 @@
// #docregion
import 'package:angular2/angular2.dart';
import 'package:hierarchical_di/hero.dart';
import 'hero.dart';
@Component(
selector: 'hero-card',

View File

@ -1,7 +1,8 @@
// #docregion
import 'package:angular2/angular2.dart';
import 'package:hierarchical_di/restore_service.dart';
import 'package:hierarchical_di/hero.dart';
import 'hero.dart';
import 'restore_service.dart';
@Component(
selector: 'hero-editor',

View File

@ -1,10 +1,11 @@
// #docregion
import 'package:angular2/angular2.dart';
import 'package:hierarchical_di/hero.dart';
import 'package:hierarchical_di/heroes_service.dart';
import 'package:hierarchical_di/hero_editor_component.dart';
import 'package:hierarchical_di/hero_card_component.dart';
import 'package:hierarchical_di/edit_item.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',
@ -41,13 +42,13 @@ class HeroesListComponent {
.toList();
}
onCanceled(EditItem<Hero> editItem) {
editItem.editing = false;
}
onSaved(EditItem<Hero> editItem, Hero updatedHero) {
editItem.item = updatedHero;
editItem.editing = false;
}
onCanceled(EditItem<Hero> editItem) {
editItem.editing = false;
}
}
// #enddocregion

View File

@ -1,5 +1,7 @@
// #docregion
import 'package:angular2/angular2.dart';
import 'package:hierarchical_di/hero.dart';
import 'hero.dart';
@Injectable()
class HeroesService {

View File

@ -1,19 +1,15 @@
# #docregion
name: 'hierarchical_di'
description: Hierarchical dependency injection example
version: 0.0.1
description: hierarchical dependency injection example
environment:
sdk: '>=1.0.0 <2.0.0'
sdk: '>=1.13.0 <2.0.0'
dependencies:
angular2: '2.0.0-beta.1'
angular2: 2.0.0-beta.2
browser: ^0.10.0
dart_to_js_script_rewriter: '^0.1.0'
dart_to_js_script_rewriter: ^0.1.0
transformers:
- angular2:
platform_directives:
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
platform_directives: 'package:angular2/common.dart#COMMON_DIRECTIVES'
entry_points: web/main.dart
- dart_to_js_script_rewriter

View File

@ -1,7 +1,7 @@
// #docregion
import 'package:angular2/bootstrap.dart';
import 'package:hierarchical_di/heroes_service.dart';
import 'package:hierarchical_di/heroes_list_component.dart';
import 'package:hierarchical_di/heroes_service.dart';
void main() {
bootstrap(HeroesListComponent, [HeroesService]);

View File

@ -1,7 +1,8 @@
// #docregion
import 'package:angular2/angular2.dart';
import 'logger_service.dart';
import 'child_component.dart';
import 'logger_service.dart';
@Component(
selector: 'after-content',

View File

@ -1,5 +1,6 @@
// #docregion
import 'package:angular2/angular2.dart';
import 'child_component.dart';
import 'logger_service.dart';

View File

@ -1,11 +1,12 @@
// #docregion
import 'package:angular2/angular2.dart';
import 'peek_a_boo_parent_component.dart';
import 'on_changes_component.dart';
import 'after_view_component.dart';
import 'after_content_parent.dart';
import 'spy_component.dart';
import 'after_view_component.dart';
import 'counter_component.dart';
import 'on_changes_component.dart';
import 'peek_a_boo_parent_component.dart';
import 'spy_component.dart';
@Component(
selector: 'my-app',

View File

@ -1,7 +1,8 @@
// #docregion
import 'package:angular2/angular2.dart';
import 'spy_directive.dart';
import 'logger_service.dart';
import 'spy_directive.dart';
@Component(
selector: 'my-counter',

View File

@ -1,6 +1,7 @@
import 'package:angular2/angular2.dart';
import 'dart:async';
import 'package:angular2/angular2.dart';
@Injectable()
class LoggerService {
List<String> logs = [];

View File

@ -1,7 +1,8 @@
// #docregion
import 'package:angular2/angular2.dart';
import 'dart:convert';
import 'package:angular2/angular2.dart';
class Hero {
String name;
Hero(this.name);

View File

@ -1,7 +1,8 @@
// #docregion
// #docregion lc-imports
import 'package:angular2/angular2.dart';
import 'package:lifecycle_hooks/logger_service.dart';
import 'logger_service.dart';
int nextId = 1;

View File

@ -1,7 +1,8 @@
// #docregion
import 'package:angular2/angular2.dart';
import 'package:lifecycle_hooks/logger_service.dart';
import 'package:lifecycle_hooks/peek_a_boo_component.dart';
import 'logger_service.dart';
import 'peek_a_boo_component.dart';
@Component(
selector: 'peek-a-boo-parent',

View File

@ -1,5 +1,6 @@
// #docregion
import 'package:angular2/angular2.dart';
import 'logger_service.dart';
import 'spy_directive.dart';

View File

@ -1,5 +1,6 @@
// #docregion
import 'package:angular2/angular2.dart';
import 'logger_service.dart';
int nextId = 1;

View File

@ -1,10 +1,11 @@
# #docregion
name: lifecycle_hooks
description: Lifecycle Hooks
version: 0.0.1
environment:
sdk: '>=1.13.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.1
angular2: 2.0.0-beta.2
browser: ^0.10.0
dart_to_js_script_rewriter: ^0.1.0
transformers:

View File

@ -1,8 +1,10 @@
# #docregion
name: angular2_getting_started
version: 0.0.1
environment:
sdk: '>=1.13.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.0
angular2: 2.0.0-beta.2
browser: ^0.10.0
transformers:
- angular2:

View File

@ -1,8 +1,10 @@
# #docregion
name: angular2_getting_started
version: 0.0.1
environment:
sdk: '>=1.13.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.0
angular2: 2.0.0-beta.2
browser: ^0.10.0
dart_to_js_script_rewriter: ^0.1.0
transformers:

View File

@ -1,7 +1,8 @@
// #docregion
import 'package:angular2/angular2.dart';
import 'dart:async';
import 'package:angular2/angular2.dart';
int nextId = 1;
@Component(

View File

@ -1,8 +1,9 @@
// #docplaster
// #docregion
import 'package:angular2/angular2.dart';
import 'unless_directive.dart';
import 'heavy_loader_component.dart';
import 'unless_directive.dart';
@Component(
selector: 'structural-directives',
@ -18,4 +19,3 @@ class StructuralDirectivesComponent {
get hero => heroes[0];
}
//#enddocregion

View File

@ -106,4 +106,3 @@
<div>{{ hero }}</div>
</template>
<!-- #enddocregion ngFor-template -->
<!-- #enddocregion -->

View File

@ -29,4 +29,3 @@ class UnlessDirective {
// #docregion unless-declaration
}
// #enddocregion unless-declaration
// #enddocregion

View File

@ -1,10 +1,11 @@
# #docregion
name: structural_directives
description: Structural directives example
version: 0.0.1
environment:
sdk: '>=1.13.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.1
angular2: 2.0.0-beta.2
browser: ^0.10.0
dart_to_js_script_rewriter: ^0.1.0
transformers:

View File

@ -3,9 +3,9 @@ import 'package:angular2/angular2.dart';
import 'click_me_component.dart';
import 'click_me_component_2.dart';
import 'loop_back_component.dart';
import 'keyup_components.dart';
import 'little_tour_component.dart';
import 'loop_back_component.dart';
@Component(
selector: 'my-app',

View File

@ -1,10 +1,15 @@
# #docregion
name: user_input
description: User Input
description: User input example
version: 0.0.1
environment:
sdk: '>=1.13.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.0
angular2: 2.0.0-beta.2
browser: ^0.10.0
dart_to_js_script_rewriter: ^0.1.0
transformers:
- angular2:
platform_directives: 'package:angular2/common.dart#CORE_DIRECTIVES'
entry_points: web/main.dart
- dart_to_js_script_rewriter

View File

@ -41,7 +41,7 @@ p.
specify the angular2 and browser packages as dependencies,
as well as the angular2 transformer.
Angular 2 is still changing, so provide an exact version:
<b>2.0.0-beta.0</b>.
<b>2.0.0-beta.2</b>.
+makeExample('quickstart/dart/ex1/pubspec.yaml', null, 'pubspec.yaml')