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:
@ -10,10 +10,9 @@ import {
|
||||
ChangeDetection,
|
||||
DynamicChangeDetection,
|
||||
JitChangeDetection,
|
||||
PreGeneratedChangeDetection,
|
||||
Pipes,
|
||||
defaultPipes
|
||||
PreGeneratedChangeDetection
|
||||
} from 'angular2/src/change_detection/change_detection';
|
||||
import {DEFAULT_PIPES} from 'angular2/pipes';
|
||||
import {EventManager, DomEventsPlugin} from 'angular2/src/render/dom/events/event_manager';
|
||||
import {Compiler, CompilerCache} from 'angular2/src/core/compiler/compiler';
|
||||
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
|
||||
@ -114,7 +113,7 @@ function _injectorBindings(): List<Type | Binding | List<any>> {
|
||||
Compiler,
|
||||
CompilerCache,
|
||||
ViewResolver,
|
||||
bind(Pipes).toValue(defaultPipes),
|
||||
DEFAULT_PIPES,
|
||||
bind(ChangeDetection).toClass(bestChangeDetection),
|
||||
ViewLoader,
|
||||
DirectiveResolver,
|
||||
|
@ -18,16 +18,16 @@ import {
|
||||
DynamicChangeDetection,
|
||||
JitChangeDetection,
|
||||
PreGeneratedChangeDetection,
|
||||
Pipes,
|
||||
defaultPipes,
|
||||
IterableDiffers,
|
||||
defaultIterableDiffers,
|
||||
KeyValueDiffers,
|
||||
defaultKeyValueDiffers
|
||||
} from 'angular2/src/change_detection/change_detection';
|
||||
import {DEFAULT_PIPES} from 'angular2/pipes';
|
||||
import {StyleUrlResolver} from 'angular2/src/render/dom/compiler/style_url_resolver';
|
||||
import {ExceptionHandler} from 'angular2/src/core/exception_handler';
|
||||
import {DirectiveResolver} from 'angular2/src/core/compiler/directive_resolver';
|
||||
import {PipeResolver} from 'angular2/src/core/compiler/pipe_resolver';
|
||||
import {ViewResolver} from 'angular2/src/core/compiler/view_resolver';
|
||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {Promise, PromiseWrapper, PromiseCompleter} from 'angular2/src/facade/async';
|
||||
@ -123,11 +123,12 @@ function _injectorBindings(appComponentType, bus: WebWorkerMessageBus,
|
||||
Compiler,
|
||||
CompilerCache,
|
||||
ViewResolver,
|
||||
defaultPipes,
|
||||
DEFAULT_PIPES,
|
||||
bind(IterableDiffers).toValue(defaultIterableDiffers),
|
||||
bind(KeyValueDiffers).toValue(defaultKeyValueDiffers),
|
||||
bind(ChangeDetection).toClass(bestChangeDetection),
|
||||
DirectiveResolver,
|
||||
PipeResolver,
|
||||
Parser,
|
||||
Lexer,
|
||||
bind(ExceptionHandler).toFactory(() => new ExceptionHandler(new PrintLogger()), []),
|
||||
|
Reference in New Issue
Block a user