如何在加载时设置自动完成输入框数据?

问题描述 投票:0回答:1

我正在一个需要在父组件的ngInit()上设置文本输入数据的项目中。

基本上,我有一个组件,它是一个Google AutoComplete下拉列表,并且我在其中填充了该组件的HTML主页面。

如何在调用此组件的主页上设置值?

我正在遵循与This Tutorial完全相同的源代码。

这里我有一个AutocompleteComponent,负责在下拉列表中显示该地点。和这个从app.component.html加载。

我想为AutoCompleteComponent中的addresstext app.component.ts输入文本框设置一些值。可能来自ngInit()app.component.ts

我该如何实现?

javascript angular typescript google-places-api
1个回答
0
投票

使用Angular的@Input属性将数据从父组件发送到子组件

https://angular.io/guide/component-interaction

© www.soinside.com 2019 - 2024. All rights reserved.