How to get the parent DOM element reference of an angular2 component

前端 未结 5 1865
醉酒成梦
醉酒成梦 2021-01-04 20:32

I need to access to some properties of the parent DOM element which contains the component from where i want to get the info, is there a way to do such thing?

Here i

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-04 21:35

    If you want to get data from the parent component, you may want to review data exchange methods between components. It seems to me that you may want to take a look at the Input decorator. You can do something like: Or

    Take a look at it here: https://angular.io/guide/inputs-outputs

提交回复
热议问题