angular - Ionic 2 linked select option -
in ionic 2 how can create linked select option.
for example:
<select> <option selected hidden>select country</option> <option>germany</option> <option>belgium</option> </select> <select> <option selected hidden>select city</option> <option>berlin</option> <option>dortmund</option> <option>hamburg</option> <option>brussels</option> </select> and when select germany in select option 2 shows german cities , when choose city display data city
i suggest dynamically populating second select options. have object of countries index list of related cities , attach event listener change event on county select populates cities select options:
{ germany: ['berlin', 'dortmund', 'hamburg', 'brussels', ...] belgium: [...], england: [...], } then populate county list using indexes of object , have entire thing dynamic.
Comments
Post a Comment