2016-12-12 53 views
2

我想在應用中集成intro.js。集成導致未處理Promise拒絕

我得到了intro.js框架(2.4.0)和@types(2.0.28)。 我的代碼構建,但不執行。

import { Component, OnInit } from '@angular/core'; 

@Component({ 
    selector: 'my', 
    template: require('./my.component.html') 
}) 
export class My implements OnInit { 

    ngOnInit() { 
     introJs('introduction').start(); 
    } 
} 

introJS方法在TypeScript中識別。 enter image description here

我有這樣的錯誤:

Unhandled Promise rejection: introJs is not defined ; Zone: angular ; Task: Promise.then ; Value: ReferenceError: introJs is not defined(…) ReferenceError: introJs is not defined 

你有什麼想法?

+2

您需要安裝&轉介類型'IntroJS' –

+0

您正在導入庫? – Bazinga

+0

是的,我安裝@type/intro.js並導入庫intro.js。我的環境識別introJS方法 – di99er

回答

1

您不能直接在angular2上直接使用JS。您可以按照this tutorialthis package尋找正確的解決方案。祝你好運。

+0

謝謝,我的代碼在TypeScript中 – di99er

相關問題