File

src/app/shared/props-table/props-table.component.ts

Description

Component used to display the properties of an alarm

Implements

OnInit

Metadata

selector app-props-table
styleUrls ./props-table.component.scss
templateUrl ./props-table.component.html

Index

Methods
Inputs

Constructor

constructor()

Builds an instance of the component

Inputs

alarm
Type : Alarm

Alarm object associated to the component

Methods

ngOnInit
ngOnInit()

Method executed when the component is initiated

Returns : void
import { Component, OnInit, Input } from '@angular/core';
import { Alarm} from '../../data/alarm';

/**
 * Component used to display the properties of an alarm
 */
@Component({
  selector: 'app-props-table',
  templateUrl: './props-table.component.html',
  styleUrls: ['./props-table.component.scss']
})
export class PropsTableComponent implements OnInit {

  /**
  * Alarm object associated to the component
  */
  @Input() alarm: Alarm;

  /**
   * Builds an instance of the component
   */
  constructor() { }

  /**
   * Method executed when the component is initiated
   */
  ngOnInit() {
  }

}
<div class=props-table-container>
  <table>
    <tr *ngFor="let prop of alarm.properties | keyvalue">
      <th> {{ prop.key }}: </th>
      <td> {{ prop.value }} </td>
    </tr>
  </table>
</div>

./props-table.component.scss

.props-table-container {

  table, th, td {
    border-width: 0px;
    border-style: solid;
  }

  table {
    vertical-align: top;
    width: 100%;
  }

  th, td {
    vertical-align: top;
    padding: 0px 4px;
  }

  th {
    width: fit-content;
  }

  td {
    max-width: 320px;
    width: 100%;
    word-wrap: break-word;
  }

}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""