src/app/root/companies/companies.component.ts
selector | crm-companies |
styleUrls | companies.component.scss |
templateUrl | ./companies.component.html |
Properties |
Methods |
constructor(companiesService: CompaniesService)
|
||||||||
Parameters :
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
companies |
companies:
|
Type : Company[]
|
Default value : []
|
import { Component, OnInit } from '@angular/core';
import {CompaniesService} from "./companies.service";
import {Company} from "../../core/models/auth/company.model";
@Component({
selector: 'crm-companies',
templateUrl: './companies.component.html',
styleUrls: ['./companies.component.scss']
})
export class CompaniesComponent implements OnInit {
companies: Company[] = [];
constructor(private companiesService: CompaniesService) { }
ngOnInit() {
this.companiesService.getCompaniesList().subscribe(
companies => this.companies = companies,
error => console.log(error)
)
}
}
<div class="card">
<div class="card-block">
<table class="table table-hover table-outline m-b-0">
<thead class="thead-default">
<tr>
<th>Company name</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let company of companies">
<td class="text-xs-center">
<a [routerLink]="['/root', 'company', company.id]">{{company.name}}</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>