
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
28 lines
800 B
TypeScript
28 lines
800 B
TypeScript
import {AsyncPipe} from './async_pipe';
|
|
import {UpperCasePipe} from './uppercase_pipe';
|
|
import {LowerCasePipe} from './lowercase_pipe';
|
|
import {JsonPipe} from './json_pipe';
|
|
import {LimitToPipe} from './limit_to_pipe';
|
|
import {DatePipe} from './date_pipe';
|
|
import {DecimalPipe, PercentPipe, CurrencyPipe} from './number_pipe';
|
|
|
|
import {CONST_EXPR} from 'angular2/src/facade/lang';
|
|
import {Binding, OpaqueToken} from 'angular2/di';
|
|
|
|
const DEFAULT_PIPES_LIST = CONST_EXPR([
|
|
AsyncPipe,
|
|
UpperCasePipe,
|
|
LowerCasePipe,
|
|
JsonPipe,
|
|
LimitToPipe,
|
|
DecimalPipe,
|
|
PercentPipe,
|
|
CurrencyPipe,
|
|
DatePipe
|
|
]);
|
|
|
|
export const DEFAULT_PIPES_TOKEN = CONST_EXPR(new OpaqueToken("Default Pipes"));
|
|
|
|
export const DEFAULT_PIPES =
|
|
CONST_EXPR(new Binding(DEFAULT_PIPES_TOKEN, {toValue: DEFAULT_PIPES_LIST}));
|