@paycargo/js-angular
Version:
First, run `npm i @paycargo/js-angular` in your Command Line Interface. Afterwards, the following dependency will be found in the `package.json`. The ellipses (...) represent the presence of other possible code.
60 lines (48 loc) • 1.54 kB
Markdown
## Angular
First, run `npm i in your Command Line Interface. Afterwards, the following dependency will be found in the `package.json`. The ellipses (...) represent the presence of other possible code.
```
. . .
{
"dependencies": {
. . .
"@paycargo/js-angular": "0.0.1"
. . .
}
. . .
```
Next, import `CUSTOM_ELEMENTS_SCHEMA` and `PayCargoCheckoutModule` within `app.module.ts` as follows:
```
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
. . .
import { PayCargoCheckoutModule } from '@paycargo/js-angular';
. . .
```
Then, import the following code within the component that the PayCargo Checkout button will be added to. In this example, it is called `app.component.ts`.
```
import { Options } from '@paycargo/js';
import { PaycargoCheckout } from '@paycargo/js-angular';
```
Next, pass Options into the component within the `app.component.ts` file.
```
export class AppComponent implements AfterViewInit {
pcbutton!: ElementRef<PaycargoCheckout>;
public options: Options = {
env: 'dev',
code: 'agi',
brand: 'agi',
originURL: 'https://7k93ml-4200.csb.app/',
size: 'lg',
};
```
In `app.component.html`, declare the Element to load the Component onto the page.
```
<paycargo-checkout id="paycargo-checkout-button" #pccheckout [options]="options"
[pcTransactions]="selectedTransactions">
</paycargo-checkout>
```
/js-angular`