angular - Angular-如何从 Angular 中的 URL 获取特定参数
解决方案
您可以使用 ActivateRoute 从 url 获取参数。以下来自角度文档的示例:
constructor(
private route: ActivatedRoute,
private router: Router ) {}
ngOnInit() {
const heroId = this.route.snapshot.paramMap.get('id');
this.hero$ = this.service.getHero(heroId);
}
推荐阅读
- typo3 - 始终相同,错误的错误代码:“糟糕,发生错误!找不到类 '2'”
- c# - IIS Express 防止在代码更改时重新加载
- angular - 如何修复'未知方法'登录'Angular' - 在登录/注册页面
- azure - 无法从 Azure 中的可用性测试触发自动缩放
- c# - 为什么这些快速排序算法不能完全发挥作用?
- powerbuilder - 为什么 Powerbuilder 在部署中重建源代码 3 次?
- aws-glue - 使用 AWS Glue 目录的外部表和数据库
- python - 替换 Pandas 多列中的一系列整数值
- vue.js - Vue2Leaflet 组件不显示地图
- python - 如何使用 between 将字符串值转换为 DateTimeIndex 以进行熊猫范围选择?