How to show the same Spartacus component but in a different place without using custom components

334 views Asked by At

I am new to Spartacus. I just want to show the Sing in / Register link in a popup on clicking one nav button. I don't want to modify any working/functionality of the link "Sign in / Register". How can we achieve this in Spartacus?

1

There are 1 answers

1
tobi-or-not-tobi On

The login component and register components are by default assigned to CMS components, but they can also be used by their selectors. If you need to wrap them in another component (i.e. modal), you could import them by their selectors. You would first create a container component that is opened on navigation click, and then add the login / register components inside the container component. For example:

<div class="container-modal-thing">
  <cx-login></cx-login>
  <cx-login-register></cx-login-register>
</div>

You would also need to import the LoginModule and/or LoginRegisterModule in the component that declares the our custom container component.