Rachit
Rachit

Reputation: 403

How to add buttons to my Spartacus storefront?

I am trying to add buttons to my Spartacus storefront.

The problem that is preventing me to progress ahead is:

1)If I generate new button angular component, using Angular, should it be mentioned inside the tag or outside of that?

2)Should it be rendered in a different way as first?

Upvotes: 1

Views: 622

Answers (2)

Jasper
Jasper

Reputation: 182

Check out this repo and the corresponding stackblitz project. The easiest way add new buttons would be to place it in reference to an existing standard component using the outlets. Essentially, you could do some like the following, placing your new angular component app-custom-component before the ExistingComponent.

<ng-template cxOutletRef="ExistingComponent" cxOutletPos="before">
  <app-custom-component></app-custom-component>
</ng-template>

Upvotes: 1

sgrpwr
sgrpwr

Reputation: 461

Can you describe the problem more clearly? As much as I understood you are looking for below kind of code. For code check this link Spartacus Product Page

<div class="row">
  <div class="col-md-6">
    <button
      class="btn btn-block btn-action"
      (click)="addAddressButtonHandle()"
    >
      {{ 'addressBook.addNewAddress' | cxTranslate }}
    </button>
  </div>
</div>

Upvotes: 0

Related Questions