feat(ElementInjector): implement ElementInjector

This commit is contained in:
vsavkin
2014-10-14 16:00:35 -04:00
parent ea0df352be
commit e3548b497f
27 changed files with 865 additions and 68 deletions

View File

@ -22,6 +22,8 @@ class ListWrapper {
static void set(m, k, v) { m[k] = v; }
static contains(m, k) => m.containsKey(k);
static map(list, fn) => list.map(fn).toList();
static find(List list, fn) => list.firstWhere(fn, orElse:() => null);
static any(List list, fn) => list.any(fn);
static forEach(list, fn) {
list.forEach(fn);
}

View File

@ -41,6 +41,18 @@ export class ListWrapper {
if (!array || array.length == 0) return null;
return array[array.length - 1];
}
static find(list:List, pred:Function) {
for (var i = 0 ; i < list.length; ++i) {
if (pred(list[i])) return list[i];
}
return null;
}
static any(list:List, pred:Function) {
for (var i = 0 ; i < list.length; ++i) {
if (pred(list[i])) return true;
}
return false;
}
static reversed(array) {
var a = ListWrapper.clone(array);
return a.reverse();

View File

@ -0,0 +1,9 @@
library angular.core.facade.math;
import 'dart:math' as math;
class Math {
static num pow(num x, num exponent) {
return math.pow(x, exponent);
}
}

View File

@ -0,0 +1 @@
export var Math = window.Math;