首页 文章

管道在angular2中不起作用

提问于
浏览
0

我在组件代码中添加了以下行

pipes: [ OrderByPipe ].

它显示以下错误

类型'{selector:string; templateUrl:string;管道:typeof OrderByPipe []; }'不能分配给'Component'类型的参数 . 对象文字只能指定已知属性,“组件”类型中不存在“管道” .

怎么解决这个问题

1 回答

  • 2

    pipes@Component() 中是旧的方式,不再支持

    添加管道

    @NgModule({
      declarations: [OrderByPipe],
      ...
    })
    

相关问题