Include Plaid-link in an Ionic2 project?

两盒软妹~` 提交于 2019-12-23 18:37:56

问题


I want to use Plaid Link in my Ionic 2 project. From experience working with it on the web and from the documentation it seems apparent that you just install

<script src="https://cdn.plaid.com/link/v2/stable/link-initialize.js"></script>

in the body of the index.html and you're ready to go with the Plaid object available everywhere in the project. When I do this in my Ionic 2 project and try to call Plaid I get the message: "Cannot find name 'Plaid'".

My index.html:

<head>
<meta charset="UTF-8">
  <title>Ionic App</title>
  <script src="cordova.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <meta name="format-detection" content="telephone=no">
  <meta name="msapplication-tap-highlight" content="no">
  <link rel="icon" type="image/x-icon" href="assets/icon/favicon.ico">
  <link rel="manifest" href="manifest.json">
  <meta name="theme-color" content="#4e8ef7">
  <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~locale.en"></script>
<link href="build/main.css" rel="stylesheet">
</head>

<body>
   <ion-app></ion-app>
   <script src="build/polyfills.js"></script>
   <script src="build/main.js"></script>
   <script src="https://cdn.plaid.com/link/stable/link-initialize.js"></script>
</body>

example.js where I try to call use the Plaid object and get the aforementioned error:

@Component({
  selector: 'someClass',
  templateUrl: 'someClass.html'
})
export class someClass  {
   usePlaid(): any{
    Plaid.create({...})
   }

}

来源:https://stackoverflow.com/questions/42590648/include-plaid-link-in-an-ionic2-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!