本文整理汇总了TypeScript中angular2/change_detection.Pipes类的典型用法代码示例。如果您正苦于以下问题:TypeScript Pipes类的具体用法?TypeScript Pipes怎么用?TypeScript Pipes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pipes类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: bind
import {bind} from 'angular2/di';
import {PipeRegistry, Pipes, defaultPipes} from 'angular2/change_detection';
/*
* App Pipes
*/
import {capitalize} from './CapitalizePipe';
import {rxAsync} from './RxPipe';
var newPipesBindings;
// Alpha.31
if (Pipes) {
newPipesBindings = bind(Pipes).toValue(Pipes.append({
'async': rxAsync,
'capitalize': capitalize
// add more pipes to this Map
}));
}
// Alpha.30
else if (PipeRegistry) {
// include the default pipes and our own
let replaceBindings = Object.assign({}, defaultPipes, {
'async': rxAsync,
'capitalize': capitalize
// add more pipes to this Map
});
newPipesBindings = bind(PipeRegistry).toValue(new PipeRegistry(replaceBindings));
}
export var appPipeInjectables = [
示例2:
/// <reference path="../../typings/_custom.d.ts" />
/*
* Angular 2
*/
import {Pipes} from 'angular2/change_detection';
/*
* App Pipes
*/
import {capitalize} from './CapitalizePipe';
import {rxAsync} from './RxPipe';
export var appPipes = [
Pipes.extend({
'async': rxAsync,
'capitalize': capitalize
// add more pipes to this Map
})
];
示例3:
/// <reference path="../../typings/_custom.d.ts" />
import {Pipes} from 'angular2/change_detection';
import {rxAsync} from './RxPipe';
export var appPipes = [
Pipes.extend({
'async': rxAsync
})
];