我想在打字稿中导入js文件。我想访问js文件中的对象和函数。另外,我在index.html中添加了js文件,但是它也不起作用。所以我找到了一个提示“导入'[js文件路径]''”,但是它不起作用。
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { NavParams } from 'ionic-angular';
import '../../pages/mobile.js';
@Component({
selector: 'page-success',
templateUrl: 'success.html'
})
export class SuccessPage {
constructor(public navCtrl: NavController, public navParms: NavParams) {
let centerPos = new atlan.maps.UTMK(953933.75, 1952050.75);
}
}
这是success.ts文件。我想找到“大西洋”物体。请给我一个解决方案。多谢!
您必须使用clarify关键字,以免出现任何编译错误。您可以执行以下操作
import { Component } from '@angular/core';
....
/* Here you are telling typescript compiler to
ignore this variable it did not originate with typescript.*/
declare var atlan: any;
@Component({
selector: 'page-success',
templateUrl: 'success.html'
})
export class SuccessPage {
....
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句