Skip to content
Snippets Groups Projects
Commit 1b3d77fa authored by Menou Lucas's avatar Menou Lucas
Browse files

Add docs on attribute-label

parent f8f9d886
No related branches found
No related tags found
1 merge request!98(fix):Add OnInit method for the label to use on app-attribute-label
This commit is part of merge request !98. Comments created here will be created in the context of that merge request.
...@@ -7,16 +7,26 @@ ...@@ -7,16 +7,26 @@
* file that was distributed with this source code. * 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 * @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', selector: 'app-attribute-label',
templateUrl: 'attribute-label.component.html', templateUrl: 'attribute-label.component.html',
changeDetection: ChangeDetectionStrategy.OnPush changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class AttributeLabelComponent implements OnInit { export class AttributeLabelComponent implements OnInit {
@Input() label: string; @Input() label: string;
...@@ -24,7 +34,13 @@ export class AttributeLabelComponent implements OnInit { ...@@ -24,7 +34,13 @@ export class AttributeLabelComponent implements OnInit {
@Input() form_label?: string; @Input() form_label?: string;
name: string = null; 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() { ngOnInit() {
this.name = this.form_label ? this.form_label : this.label; this.name = this.form_label ? this.form_label : this.label;
}; }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment