Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
610
Prepopulate the selected igx-combo control value in a reactive form
posted

Hi,

I'm looking at your Angular sample for igx-combo using reactive forms: stackblitz.com/.../klrlneojxek.  Is there a way to set a default selected value in the igx-combo controls in the reactive form?   For example in your sample, I'd like to use this form to buy new movie tickets and edit existing movie tickets.  When editing you'd need to prepopulate the already selected value of combo box as well as the date picker.

Thanks,

JK

  • 610
    Verified Answer
    Offline posted

    This can been resolved:

        public ds = ["Comedy"];

        public user: FormGroup;

        constructor(fb: FormBuilder) {

            this.user = fb.group({

                date:  new FormControl( new Date("2018-08-27")),

                dateTime: [""],

                email: ["", Validators.required],

                fullName: new FormControl("", Validators.required),

                genres: new FormControl(this.ds, Validators.required),

                phone: [""]

            });