集成导致未处理的Promise拒绝

时间:2016-12-12 15:50:44

标签: angular intro.js

我想在我的应用中集成intro.js。

我得到了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

你有什么想法吗?

1 个答案:

答案 0 :(得分:1)

你不能直接用angular2直接使用JS。您可以关注this tutorialthis package以获得正确的解决方案。祝你好运。