There is a main page in which filters are set. All filter parameter lists are recorded from the database request. Example

$data['attr_colors'] = $this->model_catalog_form->getAttributs(14); 

And displayed like this

  <div class="params input_price one_group" > <select name="count_modules" placeholder="" tabindex=3> <option>Количество модулей</option> <?php foreach($attr_modules as $attr_module) { echo "<option>".$attr_module["text"]."</option>"; } ?> </select> </div> 

The question is how to set the selected parameter to option (selected). Thanks in advance (it is possible to somehow get the selected parameter from the string)

    1 answer 1

    Angular Solution

     <select class="plating" ng-model="main.sel" ng-options="opt.name as opt.name for opt in main.list" ng-disabled="main.viewMode"> </select> 

    Js

     this.list = [{ "name": "one" }, { "name": "two" }, { "name": "three" } ]; this.sel = this.list[1]; //будет выбрано 
    • Please try to write more detailed answers. I am sure the author of the question would be grateful for your expert commentary on the code above. - Nicolas Chabanovsky