Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Number Count animation angular 2

Hello I need to do the number counts with animation in angular 2 . I have a example in Jquery. I need to achieve this in angular 2. I need to do like the below example Codepen Example

like image 527
Ben10 Avatar asked Jan 11 '18 11:01

Ben10


1 Answers

try below code :

$ npm install ng2-odometer --save

app.module.ts

 import { Ng2OdometerModule } from 'ng2-odometer';
import { FormsModule } from '@angular/forms';

@NgModule({
  declarations: [
    AppComponent,
    DashboardComponent,

  ],
  imports: [
    HttpClientModule,
    BrowserModule,
    AppRoutingModule,FormsModule, 
    Ng2OdometerModule.forRoot(),
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

home.html

  <div style="font-size: 30px;color: white;">
        <ng2-odometer [number]="number" [config]="{ }"></ng2-odometer>
    </div>

home.ts

export class HomeComponent implements OnInit {

  public number: number = 1000;

  constructor() { }

  ngOnInit() {
  }

}

more info

like image 52
AddWeb Solution Pvt Ltd Avatar answered Sep 28 '22 13:09

AddWeb Solution Pvt Ltd