Tuesday, September 26, 2017

How to install and configure angular-typed with angular2?

I am trying to install angular-typed on angular2 but i have run out of options. I think i have tried everything in the book but it’s still not working.
Can someone hope me?
I also tried installing and using typed.js too by it did not work

https://www.npmjs.com/package/angular-typed

import { Component } from '@angular/core';
import { TypewriterModule, TypewriterContent, TypewriterService } from "ng2-typewriter";

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  name:string;
  contents: TypewriterContent[] = [];
  hobbies: TypewriterContent[] = [];
  isDone: boolean = false;
  constructor(private tws: TypewriterService) {
    this.name = 'Hello Angular2';
    this.contents = this.tws.format(['They say,', 'There are only 10 types of people in the world:', 'Those who understand binary, and those who don't.']);
    this.hobbies = this.tws.format(['Java.', 'Javascript.', 'Angular2.', 'Animation.', 'Symphony Music.', 'Movies.'])
  }

  public ngOnInit() {
    this.contents.map((v: TypewriterContent, i: number) => {
      if (i == 1){
        v.setSpecialWord("10");
      }
    })
  }

  onDone( isDone: boolean ): void {
    if(isDone){
      this.name = 'The typewriter is done.'
      setTimeout(() => this.isDone = isDone, 1500)
    }
  }
}

app.module.ts

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    TypewriterModule
  ],
  providers: [TypewriterService],
  bootstrap: [AppComponent]
})
export class AppModule { }

Error

Uncaught Error: Unexpected value 'TypewriterModule' imported by the module 'AppModule'. Please add a @NgModule annotation.

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/09/26/how-to-install-and-configure-angular-typed-with-angular2/
via @lzomedia #developer #freelance #web

No comments:

Post a Comment