小编Joh*_*uez的帖子

Angular 5 Material 5 MatTableDataSource ..."'mat-card-title'不是已知元素."

我正在尝试实现材料文档中<mat-table>描述的

TL; DR:将@ angular/core,@ angular/material和@ angular/CDK升级到版本5后,我突然无法使用与mat-card相关的标签.

我无法让所有依赖项都正确无法导入MatTableDataSource.我意识到我可以像这样实现我自己的DataSource ,但是如果它在文档中,那么确实可以在没有这个hack的情况下进行工作配置.实现我自己的DataSource也意味着丢失漂亮的可排序标头和过滤,这是我最常追求的.

我将项目升级到Angular 5思考材料也将升级,但事实并非如此.材料和CDK保持在"^ 2.0.0-beta.12".

之后npm install我看到这些警告:

npm WARN @angular/cdk@5.0.4 requires a peer of @angular/core@~5.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/cdk@5.0.4 requires a peer of @angular/common@~5.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/material@5.0.4 requires a peer of @angular/core@~5.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/material@5.0.4 requires a peer …
Run Code Online (Sandbox Code Playgroud)

material-design angular-material angular

5
推荐指数
1
解决办法
7626
查看次数

MongoDB:排序,但在结果中首先使用特定文档?

当然,由 MGMT 和销售人员设定的要求是,查询结果应包含特定文档作为第一个结果,然后是与查询匹配的所有其他文档。

这是我的数据的一个非常简单的示例:

{ _id: 1,
title: 'other item',
category: 'show'
}
{ _id: 2,
title: 'THE ITEM THAT MUST BE RETURNED FIRST',
category: 'show'
}
{ _id: 3,
title: 'other item 2',
category: 'show'
}
{ _id: 4,
title: 'item not matching query',
category: 'hide'
}
Run Code Online (Sandbox Code Playgroud)

在本例中,我在 http 请求正文中传递了 值id{ _id : 2 }并且在本例中,我需要查询匹配某些条件的所有其他文档,{ category: 'show' }但 的文章id == 2需要是返回的第一个文档:

//pseudo-code. I know this is not even close
itemsCollection.aggregate([
{ …
Run Code Online (Sandbox Code Playgroud)

mongoose mongodb mongodb-query aggregation-framework

3
推荐指数
1
解决办法
2158
查看次数