我是Angular的新人。我正在使用Angular 5。
这是我的angular-cli.json文件代码片段,我在其中注册了jQuery和typed.js脚本。
"scripts": [
"../node_modules/jquery/dist/jquery.js",
"../node_modules/typed.js/lib/typed.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
],
在我的标题组件中,我导入了jQuery和typed.js,如下面的代码
import { Component, OnInit } from '@angular/core';
import * as $ from 'jquery';
import Typed from 'typed.js';
当我想使用下面的代码片段激活插件时:
export class HeaderComponent implements OnInit {
options = null;
typed = null;
constructor() {
}
ngOnInit() {
this.options = {
strings: ['Grapich Designer', 'UI/UX Designer'],
typeSpeed: 40
};
this.typed = new Typed('.header-inner h6', this.options);
}
}
我收到了这个错误。
AppComponent.html:1 ERROR TypeError: typed_js_1.default is not a constructor
at HeaderComponent.ngOnInit (header.component.ts:21)
at checkAndUpdateDirectiveInline (core.js:12369)
at checkAndUpdateNodeInline (core.js:13893)
at checkAndUpdateNode (core.js:13836)
at debugCheckAndUpdateNode (core.js:14729)
at debugCheckDirectivesFn (core.js:14670)
at Object.eval [as updateDirectives] (AppComponent.html:12)
at Object.debugUpdateDirectives [as updateDirectives] (core.js:14655)
at checkAndUpdateView (core.js:13802)
at callViewAction (core.js:14153)