Skip to content

Instantly share code, notes, and snippets.

@daniele-zurico
Created May 28, 2018 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daniele-zurico/087f38a5ab04bf43565cef1632afc8a0 to your computer and use it in GitHub Desktop.
Save daniele-zurico/087f38a5ab04bf43565cef1632afc8a0 to your computer and use it in GitHub Desktop.
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