很抱歉,我提到了这一点。我刚接触Angle6。我已经看到了此链接https://www.npmjs.com/package/angular-timelinejs3?activeTab=readme,当我尝试在angular 6中进行操作时,我陷入了中间,因为他们说“为Angular模块的时间轴添加依赖项:ngTimeline”,这意味着哪个?。
我安装了angular-timelinejs3。当我放了CSS和JavaScript到index.html。 指示: 在app.component.html中。如何在Angular中导入ng-timeline js3。我收到了错误。模板解析错误。有人可以帮我吗?
In Index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Trial</title>
<link rel="stylesheet" href="https://cdn.knightlab.com/libs/timeline3/latest/css/timeline.css">
<script src="/node_modules/angular/angular.js"></script>
<script src="https://cdn.knightlab.com/libs/timeline3/latest/js/timeline.js"></script>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
In app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
//import { NgTimelineModule } from 'ng-timeline';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
In app.component.html
<timeline control="timeline" height="80vh" options="options"></timeline >
In app.component.ts
import { Component, OnInit } from '@angular/core';
//import 'ng-timeline';
//import 'angular-timelinejs3';
//import * as timeline from 'ng-timeline';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
ngOnInit(): void {
}
}
答案 0 :(得分:0)
此Angular-timelinejs3软件包仅支持Angular JS。缺少对Angular 2+的支持。请找到支持Angular 2+的备用时间轴软件包。