简体   繁体   中英

To use a part of HTML code of one angular component in another

I have an angular component with code looks like

main component.html
<html>
   <div1>
     some elements
   </div1>
       <div2>
         some elements
       </div2>

I just want to use div1 in another component, is that possible

in child component I Should have

<html>
<div1>
  some elements
</div1> ////from main component 
<div2>
some elements
</div2>
<div3>

some elements

You should import the component or the css file where you defined <div1> in the component where you need to use it

You may refer to this Component Interaction

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM