Reputation: 760
I am trying to import this JS library into my Ionic 4 project: 'https://secure.mlstatic.com/sdk/javascript/v1/mercadopago.js' to use it in my angular componets. I've been looking all over the web without solution.
I tried to import into my angular.json file but is not working.
"scripts": ["https://secure.mlstatic.com/sdk/javascript/v1/mercadopago.js"]
Also I tried to import directly from my index.html but it seems is not able to read it.
Docs link
Upvotes: 0
Views: 1908
Reputation: 4782
You can try like this
import { Component } from '@angular/core';
declare var Mercadopago: any;
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
constructor() {
console.log(Mercadopago);
}
}
<html>
<body>
<app-root></app-root>
</body>
<script src="https://secure.mlstatic.com/sdk/javascript/v1/mercadopago.js"></script>
</html>
Upvotes: 1