【发布时间】:2018-06-27 09:55:33
【问题描述】:
我正在使用 Angular 2,我必须创建搜索过滤器。所以我创建了一个带有搜索逻辑的管道并将其注入所需的组件中。 但是在注入时,我得到了错误。
这是我注入管道的代码,
import { FilterPipe} from '../filter.pipe';
@Component({
selector: 'app-dialog',
templateUrl: './dialog.component.html',
pipes: [FilterPipe],
styleUrls: ['./dialog.component.css']
})
这是一个错误,
Argument of type '{ selector: string; templateUrl: string; pipes: typeof FilterPipe[]; styleUrls: string[]; }' is not assignable to parameter of type 'Component'. Object literal may only specify known properties, and 'pipes' does not exist in type 'Component'.
请任何人,建议我如何在组件中添加管道。
【问题讨论】:
标签: angular2-pipe