Created
May 28, 2018 15:08
-
-
Save daniele-zurico/087f38a5ab04bf43565cef1632afc8a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component} from '@angular/core'; | |
import * as faker from 'faker'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.css'], | |
}) | |
export class AppComponent { | |
title = 'app'; | |
data: any[] = []; | |
constructor() { | |
for (let i = 0; i < 5; i++) { | |
const user = { | |
name: faker.name.findName(), | |
email: faker.internet.email(), | |
phone: faker.phone.phoneNumber(), | |
details: [], | |
}; | |
for (let j = 0; j < 2; j++) { | |
const details = { | |
street: faker.address.streetAddress(), | |
zipCode: faker.address.zipCode(), | |
city: faker.address.city(), | |
}; | |
user.details.push(details); | |
} | |
this.data.push(user); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment