0

I want to implement particles JS in Angular 7. I followed the stpes of this question. Even the comment of something about Angular 7 When I want to import the particles in my ts file, it says, that it can't find a module with that name. Must I make a new module or is the mistake anywhere else?

Here my Code:

TS:

import { Component, OnInit } from '@angular/core';
import { ParticlesConfig } from '../../assets/data/particles';

declare var particlesJS: any;

@Component({
  selector: 'home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {

  constructor() { }

  ngOnInit() {
    particlesJS('particles-js', ParticlesConfig, function() {
      console.log('callback - particles.js config loaded');
    });
  }

}

HTML:

<div class="box" id="particles-js">
  <div class="title">Particles Works!</div>
</div>
Gion Rubitschung
  • 741
  • 11
  • 31
  • [Possible duplicate](https://stackoverflow.com/questions/44293797/how-to-import-and-use-particles-js-in-an-angular-angular2-angular4-app) – yougeen Apr 01 '19 at 10:56

1 Answers1

0

Use "angular-particle" for Angular

It's implementation(documentation) is available at https://www.npmjs.com/package/angular-particle

Sunny
  • 2,183
  • 1
  • 17
  • 13