Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 0557c72

Browse files
chalinwardbell
authored andcommitted
chore(dart): updating to beta.16
closes #1192 Updated docs and samples to beta.16. For this first time, among other things, I payed particular attention to the changes that were made on the `ts` side of things (#1178). Since I wrote it up in my notes, here is the check list of `ts` updates with notes about how there might be corresponding changes on the Dart side: - public/docs/_examples/cb-dependency-injection/ts/app/main.ts - public/docs/_examples/cb-ts-to-js/ts/app/main.ts - cb not in Dart docs yet. - public/docs/_examples/dependency-injection/ts/app/car/car-injector.ts - public/docs/_examples/dependency-injection/ts/app/injector.component.ts - Updated Dart example code to avoid null argument. - public/docs/_examples/homepage-hello-world/ts/index.1.html - public/docs/_examples/homepage-tabs/ts/index.1.html - public/docs/_examples/homepage-todo/ts/index.1.html - public/docs/_examples/package.json - N/A for Dart. - public/docs/_examples/pipes/ts/app/app.component.html - public/docs/_examples/pipes/ts/app/app.component.ts - public/docs/_examples/pipes/ts/app/exponential-strength.pipe.ts - public/docs/_examples/pipes/ts/app/fetch-json.pipe.ts - public/docs/_examples/pipes/ts/app/random-pipe.component.ts - Dart version of sample code is incomplete, but did run in beta.15. - Example no longer runs, see angular/angular#8258 - public/docs/_examples/quickstart/js/package.1.json - public/docs/_examples/quickstart/ts/package.1.json - public/docs/_examples/router/ts/app/main.2.ts - public/docs/_examples/testing/ts/app/mock-router.ts - N/A for Dart. - public/docs/js/latest/_data.json - public/docs/ts/latest/_data.json - Dart equivalent updated. - public/docs/ts/latest/guide/dependency-injection.jade - No need to update since it imports the TS version. - public/docs/ts/latest/guide/pipes.jade - Not in Dart prose yet. - tools/plunker-builder/indexHtmlTranslator.js - N/A for Dart.
1 parent d5e909b commit 0557c72

File tree

23 files changed

+47
-48
lines changed

23 files changed

+47
-48
lines changed

public/docs/_examples/architecture/dart/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version: 0.0.1
55
environment:
66
sdk: '>=1.13.0 <2.0.0'
77
dependencies:
8-
angular2: 2.0.0-beta.15
8+
angular2: 2.0.0-beta.16
99
browser: ^0.10.0
1010
dart_to_js_script_rewriter: ^1.0.1
1111
transformers:

public/docs/_examples/attribute-directives/dart/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version: 0.0.1
55
environment:
66
sdk: '>=1.13.0 <2.0.0'
77
dependencies:
8-
angular2: 2.0.0-beta.15
8+
angular2: 2.0.0-beta.16
99
browser: ^0.10.0
1010
dart_to_js_script_rewriter: ^1.0.1
1111
transformers:

public/docs/_examples/dependency-injection/dart/lib/car/car_injector.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ import 'car.dart';
77

88
//#docregion injector
99
Car useInjector() {
10-
Injector injector;
10+
ReflectiveInjector injector;
1111
//#enddocregion injector
1212

1313
/*
1414
//#docregion injector-no-new
15-
// Cannot 'new' an Injector like this!
16-
var injector = new Injector([Car, Engine, Tires, Logger]);
15+
// Cannot 'new' an ReflectiveInjector like this!
16+
var injector = new ReflectiveInjector([Car, Engine, Tires, Logger]);
1717
//#enddocregion injector-no-new
1818
*/
1919

2020
//#docregion injector
2121

2222
//#docregion injector-create-and-call
23-
injector = Injector.resolveAndCreate([Car, Engine, Tires, Logger]);
23+
injector = ReflectiveInjector.resolveAndCreate([Car, Engine, Tires, Logger]);
2424
//#docregion injector-call
2525
var car = injector.get(Car);
2626
//#enddocregion injector-call

public/docs/_examples/dependency-injection/dart/lib/injector_component.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ class InjectorComponent {
3131
Hero hero;
3232

3333
String get rodent {
34-
var rous = _injector.getOptional(ROUS);
35-
if (rous != null) {
36-
throw new Exception('Aaaargh!');
34+
try {
35+
_injector.get(ROUS);
36+
} on NoProviderError {
37+
return "R.O.U.S.'s? I don't think they exist!";
3738
}
38-
return "R.O.U.S.'s? I don't think they exist!";
39+
throw new Exception('Aaaargh!');
3940
}
4041

4142
InjectorComponent(this._injector) {

public/docs/_examples/dependency-injection/dart/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version: 0.0.1
55
environment:
66
sdk: '>=1.13.0 <2.0.0'
77
dependencies:
8-
angular2: 2.0.0-beta.15
8+
angular2: 2.0.0-beta.16
99
browser: ^0.10.0
1010
dart_to_js_script_rewriter: ^1.0.1
1111
transformers:

public/docs/_examples/displaying-data/dart/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version: 0.0.1
55
environment:
66
sdk: '>=1.13.0 <2.0.0'
77
dependencies:
8-
angular2: 2.0.0-beta.15
8+
angular2: 2.0.0-beta.16
99
browser: ^0.10.0
1010
dart_to_js_script_rewriter: ^1.0.1
1111
transformers:

public/docs/_examples/forms/dart/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version: 0.0.1
55
environment:
66
sdk: '>=1.13.0 <2.0.0'
77
dependencies:
8-
angular2: 2.0.0-beta.15
8+
angular2: 2.0.0-beta.16
99
browser: ^0.10.0
1010
dart_to_js_script_rewriter: ^1.0.1
1111
transformers:

public/docs/_examples/hierarchical-dependency-injection/dart/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version: 0.0.1
55
environment:
66
sdk: '>=1.13.0 <2.0.0'
77
dependencies:
8-
angular2: 2.0.0-beta.15
8+
angular2: 2.0.0-beta.16
99
browser: ^0.10.0
1010
dart_to_js_script_rewriter: ^1.0.1
1111
transformers:

public/docs/_examples/lifecycle-hooks/dart/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version: 0.0.1
55
environment:
66
sdk: '>=1.13.0 <2.0.0'
77
dependencies:
8-
angular2: 2.0.0-beta.15
8+
angular2: 2.0.0-beta.16
99
browser: ^0.10.0
1010
dart_to_js_script_rewriter: ^1.0.1
1111
transformers:

public/docs/_examples/pipes/dart/lib/exponential_strength_pipe.dart

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,18 @@ import 'dart:math' as math;
33
import 'package:angular2/angular2.dart';
44

55
/*
6-
* Raise the value exponentially
7-
* Takes a value that defaults to 0 and an exponent argument that defaults to 1.
8-
* Checks for value to be a string or number.
9-
* Usage:
10-
* value | exponentialStrength:exponent
11-
* Example:
12-
* {{ 2 | exponentialStrength:10}}
13-
* formats to: 1024
14-
*/
15-
6+
* Raise the value exponentially
7+
* Takes an exponent argument that defaults to 1.
8+
* Usage:
9+
* value | exponentialStrength:exponent
10+
* Example:
11+
* {{ 2 | exponentialStrength:10}}
12+
* formats to: 1024
13+
*/
1614
@Pipe(name: 'exponentialStrength')
17-
@Injectable()
15+
@Injectable() // FIXME(chalin): unnecessary?
1816
class ExponentialStrengthPipe extends PipeTransform {
19-
transform(dynamic value, [List<dynamic> args]) {
20-
var v = int.parse(value.toString(), onError: (source) => 0);
21-
var p = args.isEmpty
22-
? 1
23-
: int.parse(args.first.toString(), onError: (source) => 1);
24-
return math.pow(v, p);
25-
}
17+
num transform(num value, String exponent) =>
18+
math.pow(value,
19+
num.parse(exponent, onError: (_) => 1));
2620
}

0 commit comments

Comments
 (0)