私はIDEとしてVS 2015を使用しています。私は、次のことを読んだことがある: Angular 2 typescript invoke javascript functiontypescriptからjavascript関数を呼び出す2
と
Using a Javascript Function from Typescript
と
Using a Javascript Function from Typescript
しかし、私はまだ基本を得ることはありません。私はtesting.js を持っていると私は私のapp.component.tsでtestJsを使用するにはどうすればよい
var testJs = function() {
this.asd = 123;
}
testJs.prototype.testing = function (param) {
console.log(param);
}
をapp.component.tsと仮定
?現時点ではこれを試してみましたが、失敗しました:
import { Component } from '@angular/core';
interface testJs {
testing: Function;
}
declare var testJs: testJs;
@Component({
selector: 'my-app',
templateUrl: '/mainTemplate.html'
})
export class AppComponent {
testJs.testing("adsf");
}
と私はangular.cliを持っていません。それはangular.cliなしで行うことが可能ですか?
のコンストラクタでfuncitonを使用しますが、ここで角度テストガイドを見たことがあります:https://angular.io/docs/ts/latest/testing/ – DeborahK
私はユニットテストのために見ているわけではありません。私はtypescriptからjavascript funcitonを呼び出す方法を探しています – jay
は、角度cliを使用していますか?このスクリプトをangular-cli.jsonファイルに入れる必要がありますか? –