// ========================LICENSE_END===================================
// /
-import { Component, Input, OnInit } from "@angular/core";
+import { Component, Input, OnInit, Output } from "@angular/core";
import {
AbstractControl,
ControlContainer,
FormGroupDirective,
Validators,
} from "@angular/forms";
+import { EventEmitter } from "@angular/core";
import { Rics } from "src/app/interfaces/ric";
import { PolicyService } from "src/app/services/policy/policy.service";
+import { MatSelectChange } from "@angular/material/select";
@Component({
selector: "nrcp-ric-selector",
],
})
export class RicSelectorComponent implements OnInit {
- @Input() instanceForm: FormGroup;
@Input() policyTypeName: string = "";
- ric: string;
+ @Output() selectedRic: EventEmitter<string> = new EventEmitter<string>();
+
+ ric: string = null;
+ instanceForm: FormGroup = new FormGroup({
+ ricSelector: new FormControl(this.ric, [Validators.required]),
+ });
allRics: string[] = [];
constructor(
) {}
ngOnInit(): void {
- this.instanceForm.addControl(
- "ricSelector",
- new FormControl(this.ric, [Validators.required])
- );
-
console.log("Ric:", this.ric);
this.fetchRics();
}
- get selectedRic(): string {
- return this.ric;
+ onRicChanged(newvalue: MatSelectChange): void {
+ this.selectedRic.emit(newvalue.value);
}
get ricSelector(): AbstractControl {