angular - 如何查看 observables 的运行时值
问题描述
考虑以下从路由组件接收参数的类
export class customerEntryPoint {
readonly customerId$: Observable<string>;
constructor(route: ActivatedRoute) {
this.customerId$ = route.querparams.pipe(
filter(params => params.customerId?.length > 0),
filter(params => params.customerId))l
console.log(this.customerId$)
问题。上面的代码很好,但问题是我如何使用 console.log 语句查看值,或者他们是查看值运行时间的更好方法
}
解决方案
tap
您可以在所需步骤将控制台日志放入副作用运算符
route.querparams.pipe(
filter(params => params.customerId?.length > 0),
filter(params => params.customerId),
tap(console.log))
推荐阅读
- python - 如何获取存储列表的平均年龄或等级
- python - Jinja2 在生成 HTML 文档时请求图像 url?
- javascript - 如何在给定键名的情况下从枚举中获取值
- powerbi - 在 power BI 中使用 ISO 年和 ISO 周计算同比变化
- sql - 我想用亚马逊雅典娜按日期总结 http 状态
- c# - 从 C# 中的 WPF 数据网格更新 SQL Server
- python - 我可以在 Python Django 中访问其他 MySQL 数据库而无需访问其模型吗?
- sql - 如何在具有不同时间戳的表中汇总日期
- sympy - Sympy:用平方和根化简小复合分数
- java - 配置 schema.registry.url 的值 io.confluent.kafka.schemaregistry.client.MockSchemaRegistryClient@4788c0a1 无效