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

Commit 7d79afd

Browse files
committed
chore(dart): pipes example rolled back to beta.15
The pipes example stopped working in beta.16; this rolls it back to the last known working version. See earlier commit for code changes necessary in support of beta.16: 0557c728d75e519bc6846b37492 414dff540c6ee
1 parent d313e1f commit 7d79afd

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

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

+7-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ import 'package:angular2/angular2.dart';
1212
* formats to: 1024
1313
*/
1414
@Pipe(name: 'exponentialStrength')
15-
@Injectable() // FIXME(chalin): unnecessary?
1615
class ExponentialStrengthPipe extends PipeTransform {
17-
num transform(num value, String exponent) =>
18-
math.pow(value,
19-
num.parse(exponent, onError: (_) => 1));
16+
transform(dynamic value, [List<dynamic> args]) {
17+
var v = int.parse(value.toString(), onError: (source) => 0);
18+
var p = args.isEmpty
19+
? 1
20+
: int.parse(args.first.toString(), onError: (source) => 1);
21+
return math.pow(v, p);
22+
}
2023
}

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ import 'package:angular2/angular2.dart';
88
// #docregion pipe-metadata
99
@Pipe(name: 'fetch', pure: false)
1010
// #enddocregion pipe-metadata
11-
@Injectable() // FIXME(chalin): unnecessary?
1211
class FetchJsonPipe extends PipeTransform {
1312
dynamic _fetchedValue;
1413
Future<dynamic> _fetchPromise;
1514

16-
transform(String url) {
15+
transform(dynamic url, [List<dynamic> args]) {
1716
if (_fetchPromise == null) {
1817
_fetchPromise = new Future(() async {
1918
_fetchedValue = JSON.decode(await HttpRequest.getString(url));

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

+1-1
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.16
8+
angular2: 2.0.0-beta.15
99
browser: ^0.10.0
1010
dart_to_js_script_rewriter: ^1.0.1
1111
transformers:

0 commit comments

Comments
 (0)