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

chore(dart): pipes example rolled back to beta.15 #1220

Merged
merged 1 commit into from
Apr 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ import 'package:angular2/angular2.dart';
* formats to: 1024
*/
@Pipe(name: 'exponentialStrength')
@Injectable() // FIXME(chalin): unnecessary?
class ExponentialStrengthPipe extends PipeTransform {
num transform(num value, String exponent) =>
math.pow(value,
num.parse(exponent, onError: (_) => 1));
transform(dynamic value, [List<dynamic> args]) {
var v = int.parse(value.toString(), onError: (source) => 0);
var p = args.isEmpty
? 1
: int.parse(args.first.toString(), onError: (source) => 1);
return math.pow(v, p);
}
}
3 changes: 1 addition & 2 deletions public/docs/_examples/pipes/dart/lib/fetch_json_pipe.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import 'package:angular2/angular2.dart';
// #docregion pipe-metadata
@Pipe(name: 'fetch', pure: false)
// #enddocregion pipe-metadata
@Injectable() // FIXME(chalin): unnecessary?
class FetchJsonPipe extends PipeTransform {
dynamic _fetchedValue;
Future<dynamic> _fetchPromise;

transform(String url) {
transform(dynamic url, [List<dynamic> args]) {
if (_fetchPromise == null) {
_fetchPromise = new Future(() async {
_fetchedValue = JSON.decode(await HttpRequest.getString(url));
Expand Down
2 changes: 1 addition & 1 deletion public/docs/_examples/pipes/dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version: 0.0.1
environment:
sdk: '>=1.13.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.16
angular2: 2.0.0-beta.15
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:
Expand Down