javascript - 如何在 Angular 6 中使用 angular-timelinejs3?
问题描述
对不起,正如我提到的。我是 Angular 6 的新手。我已经看到了这个链接https://www.npmjs.com/package/angular-timelinejs3?activeTab=readme,当我尝试在 Angular 6 中进行操作时。我卡在中间,因为他们说“将依赖项添加到时间轴您的角度模块:ngTimeline”这意味着哪一个?
我安装了 angular-timelinejs3。在 index.html 中添加了 css 和 javascript。当我在 app.component.html 中输入指令时?
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 {
}
}
解决方案
这个 Angular-timelinejs3 包只支持 Angular JS。缺少对 Angular 2+ 的支持。请找到支持 Angular 2+ 的备用时间线包。
推荐阅读
- sql - 获取sql中同一张表的CR_NO值
- node.js - 如何在节点 js 应用程序上创建 dist
- python - 从列中删除所有值并将其设为空白
- python - 如何在 Anaconda 中安装 freqrade?
- accessibility - 如何让屏幕阅读器读取文档加载和文档加载?
- c# - SemaphoreSlim 使用限制
- javascript - 如何在 react-google-maps/api 库中使用 containsLocation
- amazon-web-services - AWS EC2 退役
- javascript - 使用 JavaScript 将逻辑回归拟合到数据集并获得 beta 系数?
- nginx - 如何代理传递在两个不同端口上运行的两个应用程序