src/app/ui/selector/selector.component.ts
selector | framadate-selector |
styleUrls | ./selector.component.scss |
templateUrl | ./selector.component.html |
Methods |
Inputs |
constructor()
|
Defined in src/app/ui/selector/selector.component.ts:22
|
selectorConfig | |
Type : SelectorConfig
|
|
Defined in src/app/ui/selector/selector.component.ts:22
|
ngOnInit |
ngOnInit()
|
Defined in src/app/ui/selector/selector.component.ts:27
|
Returns :
void
|
import {Component, Input, OnInit} from '@angular/core';
interface Item {
label: string,
value: string
}
interface SelectorConfig {
label: string,
name: string,
id: string,
selectorNgModel: any,
listItems: Item[]
}
@Component({
selector: 'framadate-selector',
templateUrl: './selector.component.html',
styleUrls: ['./selector.component.scss']
})
export class SelectorComponent implements OnInit {
@Input() selectorConfig: SelectorConfig;
constructor() {
}
ngOnInit() {
}
}
<select
class="custom-selector"
name="{{selectorConfig.name}}"
id="{{selectorConfig.id}}"
[(ngModel)]="selectorConfig.selectorNgModel">
<option value="{{item.value}}" selected *ngFor="let item of selectorConfig.listItems">
{{item.label}}
</option>
</select>
./selector.component.scss