feat(change_detection): change binding syntax to explicitly specify pipes

This commit is contained in:
vsavkin
2015-02-19 17:47:25 -08:00
parent 69e02ee76f
commit 58ba700b14
20 changed files with 236 additions and 101 deletions

View File

@ -16,6 +16,16 @@ import {
import {NO_CHANGE, Pipe} from './pipe';
export class ArrayChangesFactory {
supports(obj):boolean {
return ArrayChanges.supportsObj(obj);
}
create():Pipe {
return new ArrayChanges();
}
}
export class ArrayChanges extends Pipe {
_collection;
_length:int;

View File

@ -1,6 +1,16 @@
import {isBlank} from 'angular2/src/facade/lang';
import {Pipe, NO_CHANGE} from './pipe';
export class NullPipeFactory {
supports(obj):boolean {
return NullPipe.supportsObj(obj);
}
create():Pipe {
return new NullPipe();
}
}
export class NullPipe extends Pipe {
called:boolean;
constructor() {

View File

@ -16,12 +16,12 @@ export class PipeRegistry {
}
var matchingConfig = ListWrapper.find(listOfConfigs,
(pipeConfig) => pipeConfig["supports"](obj));
(pipeConfig) => pipeConfig.supports(obj));
if (isBlank(matchingConfig)) {
throw new BaseException(`Cannot find a pipe for type '${type}' object '${obj}'`);
}
return matchingConfig["pipe"]();
return matchingConfig.create();
}
}