Reset the drop down values in angular4 with customized fields

48 Views Asked by At

While migrating old angular app to angular 4 I came across this in .js file customized dropdown

hps-dropdown model="studentRequest.CountryType" reset-id="countryResetId" 
is-required="false" options="countryOptions" reset- 
id="resetCountryRequestResetId">hps-dropdown

How to use the resetid in angular 4 Code:

     function setDefaultCountry() {
                var queryParams = $location.search();
                if (queryParams.Region) {
                   ---
                   ---
                    });
                    if (RegionsArray.length > 0) {
                        Code = selectedArray[0].id;
                        // Reset the id to reflect values in drop down
                        this.countryResetId = new Date();
                    }
                }
            }

how to call the same in angular 4 to rest the same But when I started implementing used normal combo box instead of above template and bind the required options.what is the use of rest-id when calling countries info.

    <select class="form-control" id="country" name="country" (change)="onCountryChange($event.target.value)" [(ngModel)]="countrySelected" required>
                                    <option value='' disabled="disabled">select</option>
                                    <option *ngFor="let country of countryList">{{country.name}}</option>
    </select>

Basically First countries will be loaded then based on it states will be loaded.

0

There are 0 best solutions below