Skip to content
Snippets Groups Projects

(fix):Add OnInit method for the label to use on app-attribute-label

Merged Menou Lucas requested to merge 130labels into develop
1 file
+ 21
5
Compare changes
  • Side-by-side
  • Inline
@@ -7,16 +7,26 @@
* file that was distributed with this source code.
*/
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import {
ChangeDetectionStrategy,
Component,
Input,
OnInit,
} from '@angular/core';
/**
* @class
* @classdesc Attribute label component.
* @classdesc Attribute label component. It chooses a label for a datum based
* on the attributes of Attribute.
* @todo Make the choice of labels more robust on the server side. A temporary
* fix for naming data has been brought to the component on init, but the patch
* is not robust.
* @implements `OnInit`
*/
@Component({
@Component({
selector: 'app-attribute-label',
templateUrl: 'attribute-label.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AttributeLabelComponent implements OnInit {
@Input() label: string;
@@ -24,7 +34,13 @@ export class AttributeLabelComponent implements OnInit {
@Input() form_label?: string;
name: string = null;
/**
* @method Choose the name of the attribute by setting the property `this.name`
* to `this.form_label` is present else to `this.label`.
* This method enables to set the name of a datum according to the property `form_label` of
* an `Attribute` rather than to the property `label` by default.
*/
ngOnInit() {
this.name = this.form_label ? this.form_label : this.label;
};
}
}
Loading