import { Injectable } from '@angular/core' ; @ Injectable ( ) export class CommonService { generateData ( length = 100000 ) { let data = [ ] ; for ( let i = 0 ; i < length ; i ++ ) { data . push ( { title : i , msg : 'hello wrold' } ) ; } return data ; } clone ( target ) { let data = [ ] ; for ( let i = 0 ; i < target . length ; i ++ ) data . push ( target [ i ] ) ; return data ; } }