简体   繁体   中英

Angular 2 show same component with same data in other component

Its more design question.

As an example I have a page that display the data, and I have a button that opens up the modal. Need to show exact same page inside the modal, and this modal is an external component.

More detail: I have a main component, inside which I have another component that receives some data from it via @Input decorator. When I view the page "main-component" it shows all data as expected from message-preview. However I created a separate modal component which is child message-preview component, which is triggered through the button inside . Ho

How can I duplicate (clone) exact same page as in in modal component without passing data again as its already there?

  <main-component>
     <app-message-preview [message]="selectedItem" [context]="context">
     </app-message-preview>
  </main-component>

External componenet

<modal-component>
        <app-message-preview [message]="selectedItem" [context]="context">
         </app-message-preview>
</modal-component>

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