I would make a Typewriter effect in angular 2 using Typedjs
As indicated the site page, I have installed the package with npm :
npm install typed.js
Then I have added this code to my component :
import Typed from 'typed.js';// not sure if it's the right way 
and
ngOnInit() {
    var typed = new Typed(".element", {
        strings: ["This is a JavaScript library", "This is an ES6 module"],
        smartBackspace: true // Default value
    });
}
Then in my html file :
<div id="typed-strings">
    <p>Typed.js is an <strong>Awesome</strong> library.</p>
    <p>It <em>types</em> out sentences.</p>
</div>
<span id="typed"></span>
I get this error :
/home/haddad/projects/siteperso/src/app/slide-presentation/slide-presentation.component.ts (18,21): Cannot find name 'Typed'.
PS: i'm open to any other proposition that do the same job as Typed.js and work with Angular 2/4
Install typed.js package in your project
npm install typed.js --save
Import typed.js in your component.ts file
import Typed from 'typed.js';
Add this code in ngOnInit() of component.ts
const options = {
     strings: ['Innovation.', 'Discovery.'],
     typeSpeed: 100,
     backSpeed: 100,
     showCursor: true,
     cursorChar: '|',
     loop: true
};
const typed = new Typed('.typed-element', options);
Create html element to render output of typed.js
<span class="typed-element">Fsfsfsfsfs</span>  
Please refer to https://github.com/vishalhulawale/angular/tree/master/integrations/typedJS
You need to change your import to import * as Typed from 'typed.js';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With