diff options
Diffstat (limited to 'src/apis.js')
| -rw-r--r-- | src/apis.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/apis.js b/src/apis.js index 3ccd95d7..8a566a46 100644 --- a/src/apis.js +++ b/src/apis.js @@ -7,7 +7,7 @@ var angularGlobal = { if (type == $object) { if (obj instanceof Array) return $array; if (isDate(obj)) return $date; - if (obj.nodeType == 1) return $element; + if (obj.nodeType == 1) return 'element'; } return type; } @@ -180,7 +180,7 @@ var angularArray = { </doc:example> */ 'sum':function(array, expression) { - var fn = angular['Function']['compile'](expression); + var fn = angularFunction.compile(expression); var sum = 0; for (var i = 0; i < array.length; i++) { var value = 1 * fn(array[i]); @@ -522,21 +522,21 @@ var angularArray = { </doc:source> <doc:scenario> it('should calculate counts', function() { - expect(binding('items.$count(\'points==1\')')).toEqual(2); - expect(binding('items.$count(\'points>1\')')).toEqual(1); + expect(binding('items.$count(\'points==1\')')).toEqual('2'); + expect(binding('items.$count(\'points>1\')')).toEqual('1'); }); it('should recalculate when updated', function() { using('.doc-example-live li:first-child').input('item.points').enter('23'); - expect(binding('items.$count(\'points==1\')')).toEqual(1); - expect(binding('items.$count(\'points>1\')')).toEqual(2); + expect(binding('items.$count(\'points==1\')')).toEqual('1'); + expect(binding('items.$count(\'points>1\')')).toEqual('2'); }); </doc:scenario> </doc:example> */ 'count':function(array, condition) { if (!condition) return array.length; - var fn = angular['Function']['compile'](condition), count = 0; + var fn = angularFunction.compile(condition), count = 0; forEach(array, function(value){ if (fn(value)) { count ++; @@ -635,7 +635,7 @@ var angularArray = { descending = predicate.charAt(0) == '-'; predicate = predicate.substring(1); } - get = expressionCompile(predicate).fnSelf; + get = expressionCompile(predicate); } return reverseComparator(function(a,b){ return compare(get(a),get(b)); @@ -796,14 +796,14 @@ var angularDate = { }; var angularFunction = { - 'compile':function(expression) { + 'compile': function(expression) { if (isFunction(expression)){ return expression; } else if (expression){ - return expressionCompile(expression).fnSelf; + return expressionCompile(expression); } else { - return identity; - } + return identity; + } } }; |
