小编Jee*_*ash的帖子

Angular - 在另一个组件的输入文本框中设置值

我试图在HTML输入文本框中设置值,该文本框是ComponentA打字稿代码的一部分,该代码是代码的一部分ComponentB.

这个 SO中获取线索我尝试做:

(<HTMLInputElement>document.getElementById("name")).value = response.name;
Run Code Online (Sandbox Code Playgroud)

但这不起作用.还有什么我需要照顾的吗?

编辑:具有Id的元素"name"在ComponentA中,并且试图操纵该元素的上述代码在ComponentB中

html textbox typescript angular

9
推荐指数
2
解决办法
6万
查看次数

标签 统计

angular ×1

html ×1

textbox ×1

typescript ×1