refactor(pipes): rename PipeRegistry to Pipes
BREAKING CHANGE: This change renames all instances of PipeRegistry to Pipes. As part of this change, the former "defaultPipes" export is now a Pipes instance, instead of a map. The map that was previously called "defaultPipes" no longer exists, but may be accessed via defaultPipes.config.
This commit is contained in:
@ -20,8 +20,8 @@ import {
|
||||
DynamicChangeDetection,
|
||||
JitChangeDetection,
|
||||
PreGeneratedChangeDetection,
|
||||
PipeRegistry,
|
||||
defaultPipeRegistry
|
||||
Pipes,
|
||||
defaultPipes
|
||||
} from 'angular2/change_detection';
|
||||
import {ExceptionHandler} from './exception_handler';
|
||||
import {ViewLoader} from 'angular2/src/render/dom/compiler/view_loader';
|
||||
@ -118,7 +118,7 @@ function _injectorBindings(appComponentType): List<Type | Binding | List<any>> {
|
||||
Compiler,
|
||||
CompilerCache,
|
||||
ViewResolver,
|
||||
bind(PipeRegistry).toValue(defaultPipeRegistry),
|
||||
bind(Pipes).toValue(defaultPipes),
|
||||
bind(ChangeDetection).toClass(bestChangeDetection),
|
||||
ViewLoader,
|
||||
DirectiveResolver,
|
||||
|
@ -52,7 +52,7 @@ import {
|
||||
onAllChangesDone
|
||||
} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {hasLifecycleHook} from './directive_lifecycle_reflector';
|
||||
import {ChangeDetector, ChangeDetectorRef, PipeRegistry} from 'angular2/change_detection';
|
||||
import {ChangeDetector, ChangeDetectorRef, Pipes} from 'angular2/change_detection';
|
||||
import {QueryList} from './query_list';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {DirectiveMetadata} from 'angular2/src/render/api';
|
||||
@ -65,7 +65,7 @@ export class StaticKeys {
|
||||
viewContainerId: number;
|
||||
changeDetectorRefId: number;
|
||||
elementRefId: number;
|
||||
pipeRegistryKey: Key;
|
||||
pipesKey: Key;
|
||||
|
||||
constructor() {
|
||||
this.viewManagerId = Key.get(avmModule.AppViewManager).id;
|
||||
@ -74,7 +74,7 @@ export class StaticKeys {
|
||||
this.changeDetectorRefId = Key.get(ChangeDetectorRef).id;
|
||||
this.elementRefId = Key.get(ElementRef).id;
|
||||
// not an id because the public API of injector works only with keys and tokens
|
||||
this.pipeRegistryKey = Key.get(PipeRegistry);
|
||||
this.pipesKey = Key.get(Pipes);
|
||||
}
|
||||
|
||||
static instance(): StaticKeys {
|
||||
@ -550,9 +550,9 @@ export class ElementInjector extends TreeNode<ElementInjector> implements Depend
|
||||
injector.internalStrategy.hydrate();
|
||||
}
|
||||
|
||||
getPipeRegistry(): PipeRegistry {
|
||||
var pipeRegistryKey = StaticKeys.instance().pipeRegistryKey;
|
||||
return this._injector.getOptional(pipeRegistryKey);
|
||||
getPipes(): Pipes {
|
||||
var pipesKey = StaticKeys.instance().pipesKey;
|
||||
return this._injector.getOptional(pipesKey);
|
||||
}
|
||||
|
||||
hasVariableBinding(name: string): boolean {
|
||||
|
@ -162,16 +162,15 @@ export class AppViewManagerUtils {
|
||||
this._setUpHostActions(view, elementInjector, i);
|
||||
}
|
||||
}
|
||||
var pipeRegistry = this._getPipeRegistry(imperativelyCreatedInjector, hostElementInjector);
|
||||
view.changeDetector.hydrate(view.context, view.locals, view, pipeRegistry);
|
||||
var pipes = this._getPipes(imperativelyCreatedInjector, hostElementInjector);
|
||||
view.changeDetector.hydrate(view.context, view.locals, view, pipes);
|
||||
}
|
||||
|
||||
_getPipeRegistry(imperativelyCreatedInjector: Injector,
|
||||
hostElementInjector: eli.ElementInjector) {
|
||||
var pipeRegistryKey = eli.StaticKeys.instance().pipeRegistryKey;
|
||||
_getPipes(imperativelyCreatedInjector: Injector, hostElementInjector: eli.ElementInjector) {
|
||||
var pipesKey = eli.StaticKeys.instance().pipesKey;
|
||||
if (isPresent(imperativelyCreatedInjector))
|
||||
return imperativelyCreatedInjector.getOptional(pipeRegistryKey);
|
||||
if (isPresent(hostElementInjector)) return hostElementInjector.getPipeRegistry();
|
||||
return imperativelyCreatedInjector.getOptional(pipesKey);
|
||||
if (isPresent(hostElementInjector)) return hostElementInjector.getPipes();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user