app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
employees = [
{
name:'Jenny',
email:'jenny@example.com',
dept:['accounting','admin','tech']
},
{
name:'Jones',
email:'jones@example.com',
dept:['marketing','admin']
},
{
name:'Raymond',
email:'raymond@example.com',
dept:['admin','tech']
},
{
name:'Jack',
email:'jack@example.com',
dept:['accounting','admin','tech','development']
}
];
}
app.component.html
<h2>Angular Nested Loop</h2>
<div *ngFor="let employee of employees">
{{employee.name}} : {{employee.email}}
<ul *ngFor="let department of employee.dept">
<li>{{department}}</li>
</ul>
</div>
- angular - How to create function
- angular - Display value using interpolation
- angular - Interpolation JavaScript method
- angular - Interpolation call method
- angular - How to use if then condition
- angular - How to use if statement
- angular - Loop through an array of objects
- angular - How to bind style
- angular - How to bind multiple style
- angular - Text input on change listener
- angular - How to get text input value
- angular - How to create a counter
- angular - Generate random number in range
- angular - Generate random whole number
- angular - How to submit form data