import { Component, OnInit } from '@angular/core';
import { Senderv3 } from 'app/models/codec/senderv3';
import { CustomerInfoService } from '../../../services/customer-info.service';
import { Router } from '@angular/router';
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
@Component({
selector: 'app-senderv3',
templateUrl: './senderv3.component.html',
styleUrls: ['./senderv3.component.scss']
})
export class Senderv3Component implements OnInit {
VirtualMsisdn = new FormControl('', Validators.required);
OperatorVariantId = new FormControl('', Validators.required);
SmsHeader = new FormControl('', Validators.required);
ServiceCode = new FormControl('', Validators.required);
form: FormGroup;
senders: Senderv3[] = [ { VirtualMsisdn: this.VirtualMsisdn.value, OperatorVariantId: this.OperatorVariantId.value,
SmsHeader: this.SmsHeader.value, ServiceCode: this.ServiceCode.value } ] as Senderv3[];
constructor(private customerInfoService: CustomerInfoService, private router: Router, private fb: FormBuilder) { }
ngOnInit() {
this.form = this.fb.group({
VirtualMsisdn: this.VirtualMsisdn,
OperatorVariantId: this.OperatorVariantId,
SmsHeader: this.SmsHeader,
ServiceCode: this.ServiceCode,
});
}
insertSenderv3() {
this.customerInfoService.insertSendersv3(this.senders).subscribe();
}
}
<button mat-raised-button (click)="insertSenderv3()" type="button" class="btn btn-success">Save</button>
Why is the parameter object for insertSendersv3(this.senders) empty? (OperatorVariantId:"" ServiceCode:"" SmsHeader:"" VirtualMsisdn:"")
Check out the screenshots below:
Your assistance on this matter would be greatly appreciated.
Thank you!