0

enter image description hereSorry, as I mentioning this. I am new to angular 6. I have seen this link https://www.npmjs.com/package/angular-timelinejs3?activeTab=readme, and when I try to do it in angular 6. I stuck in the middle as they said "Add dependency to timeline your angular module: ngTimeline" that means which one ?.

I installed angular-timelinejs3. Added css and javascript to index.html.When i put directive: in app.component.html.And how can i import the ng-timeline js3 in angular.I got the error.Template parse error.can anyone please help me in this?

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 {
  }

}

1 Answers1

1

this Angular-timelinejs3 package only supports Angular JS. Support for Angular 2+ is missing. Please find the alternate timeline package which supports Angular 2+.

Suresh Kumar Ariya
  • 9,516
  • 1
  • 18
  • 27