Angular / 从模板调用时向组件发送数据
Angular / send data to component while calling it from template
我有组件 Main。在“主要”组件中,我插入了“侧边栏”组件。
<app-sidebar></app-sidebar>
是否可以在调用 Main 时以某种方式将数据发送到该侧边栏?
<app-sidebar>
maybe put data here ?
</app-sidebar>
是的,您可以使用@Input() 来做到这一点。这个 link 应该会有帮助 Component Interactions
使用@Input()
像@Input() isDropdownClicked: boolean
我有组件 Main。在“主要”组件中,我插入了“侧边栏”组件。
<app-sidebar></app-sidebar>
是否可以在调用 Main 时以某种方式将数据发送到该侧边栏?
<app-sidebar>
maybe put data here ?
</app-sidebar>
是的,您可以使用@Input() 来做到这一点。这个 link 应该会有帮助 Component Interactions
使用@Input() 像@Input() isDropdownClicked: boolean