【发布时间】:2017-08-22 02:18:22
【问题描述】:
我正在尝试用 typescript 开发一个项目,但为此我需要在 javascript 中运行一个库,该库的链接是 https://www.grabba.com/downloads/cordova/plugin。
当我尝试用我的代码运行这个库时,ionic 2 返回上面的错误。我每天都在尝试解决它,并且已经通过了 google 中的所有集成 javascript 和 typescript 教程。有人可以帮我运行这个库吗?
我的代码如下:
guarda-codigo.ts:
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { GrabbaProxcard } from './com.grabba.cordova.plugin/www/grabba';
declare var cordova: any;
/*
Generated class for the GuardaCodigo page.
See http://ionicframework.com/docs/v2/components/#navigation for more info on
Ionic pages and navigation.
*/
@Component({
selector: 'page-guarda-codigo',
templateUrl: 'guarda-codigo.html'
})
export class GuardaCodigoPage {
constructor(public nav: NavController) {
function acessaGrabba(value: number){
let proxcard = new GrabbaProxcard();
proxcard.prototype.registerCallback();
}
}
ionViewDidLoad() {
console.log('ionViewDidLoad GuardaCodigoPage');
}
}
guarda-codigo.html:
<ion-header>
<ion-navbar>
<ion-title>GuardaCodigo</ion-title>
</ion-navbar>
</ion-header>
<ion-content class="registration">
<ion-list>
<ion-item>
<ion-label> Codigo</ion-label>
<ion-input type="text" name = "Codigo"></ion-input>
</ion-item>
</ion-list>
<button ion-button onclick="acessaGrabba(2)">Trigger</button>
</ion-content>
有人可以帮助我,我真的需要解决这个问题。我将不胜感激。感谢您的关注。
【问题讨论】:
-
看起来错误是因为 package.json。请提供package.json
标签: javascript angularjs cordova typescript ionic2