feat(pipe): added the Pipe decorator and the pipe property to View
BREAKING CHANGE: Instead of configuring pipes via a Pipes object, now you can configure them by providing the pipes property to the View decorator. @Pipe({ name: 'double' }) class DoublePipe { transform(value, args) { return value * 2; } } @View({ template: '{{ 10 | double}}' pipes: [DoublePipe] }) class CustomComponent {} Closes #3572
This commit is contained in:
@ -14,11 +14,6 @@ class SpyProtoChangeDetector extends SpyObject implements ProtoChangeDetector {
|
||||
noSuchMethod(m) => super.noSuchMethod(m);
|
||||
}
|
||||
|
||||
@proxy
|
||||
class SpyPipe extends SpyObject implements Pipe {
|
||||
noSuchMethod(m) => super.noSuchMethod(m);
|
||||
}
|
||||
|
||||
@proxy
|
||||
class SpyDependencyProvider extends SpyObject implements DependencyProvider {
|
||||
noSuchMethod(m) => super.noSuchMethod(m);
|
||||
|
@ -7,7 +7,6 @@ import {
|
||||
|
||||
import {DependencyProvider} from 'angular2/di';
|
||||
|
||||
import {BasePipe} from 'angular2/src/change_detection/pipes/pipe';
|
||||
import {SpyObject, proxy} from './test_lib';
|
||||
|
||||
export class SpyChangeDetector extends SpyObject {
|
||||
@ -18,10 +17,6 @@ export class SpyProtoChangeDetector extends SpyObject {
|
||||
constructor() { super(DynamicChangeDetector); }
|
||||
}
|
||||
|
||||
export class SpyPipe extends SpyObject {
|
||||
constructor() { super(BasePipe); }
|
||||
}
|
||||
|
||||
export class SpyDependencyProvider extends SpyObject {}
|
||||
|
||||
export class SpyIterableDifferFactory extends SpyObject {}
|
||||
|
@ -7,17 +7,17 @@ import {
|
||||
Lexer,
|
||||
ChangeDetection,
|
||||
DynamicChangeDetection,
|
||||
Pipes,
|
||||
defaultPipes,
|
||||
IterableDiffers,
|
||||
defaultIterableDiffers,
|
||||
KeyValueDiffers,
|
||||
defaultKeyValueDiffers
|
||||
} from 'angular2/src/change_detection/change_detection';
|
||||
import {DEFAULT_PIPES} from 'angular2/pipes';
|
||||
import {ExceptionHandler} from 'angular2/src/core/exception_handler';
|
||||
import {ViewLoader} from 'angular2/src/render/dom/compiler/view_loader';
|
||||
import {ViewResolver} from 'angular2/src/core/compiler/view_resolver';
|
||||
import {DirectiveResolver} from 'angular2/src/core/compiler/directive_resolver';
|
||||
import {PipeResolver} from 'angular2/src/core/compiler/pipe_resolver';
|
||||
import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_component_loader';
|
||||
import {XHR} from 'angular2/src/render/xhr';
|
||||
import {ComponentUrlMapper} from 'angular2/src/core/compiler/component_url_mapper';
|
||||
@ -122,7 +122,7 @@ function _getAppBindings() {
|
||||
Compiler,
|
||||
CompilerCache,
|
||||
bind(ViewResolver).toClass(MockViewResolver),
|
||||
defaultPipes,
|
||||
DEFAULT_PIPES,
|
||||
bind(IterableDiffers).toValue(defaultIterableDiffers),
|
||||
bind(KeyValueDiffers).toValue(defaultKeyValueDiffers),
|
||||
bind(ChangeDetection).toClass(DynamicChangeDetection),
|
||||
@ -130,6 +130,7 @@ function _getAppBindings() {
|
||||
ViewLoader,
|
||||
DynamicComponentLoader,
|
||||
DirectiveResolver,
|
||||
PipeResolver,
|
||||
Parser,
|
||||
Lexer,
|
||||
bind(ExceptionHandler).toValue(new ExceptionHandler(DOM)),
|
||||
|
Reference in New Issue
Block a user