Why doesn't Angular update the DOM by adding the 'selected' attribute to the <option> tag in ng-options when it updates the model correctly?

Using Angular 1.2.29, when I create <select>with ng-options, it appears on the surface to work as expected, when I select an option, the model is updated, and visually <select>indicates that a new option is selected.

However, when using the developer tools to view the markup, I see that the parameter tags are not updated, especially the attribute is selectednot removed from the previously selected parameter and is not added to the newly selected parameter.

<div data-ng-controller="MainController as main">

  <pre> {{ main.test.item }} </pre>

  <select
    data-ng-model="main.test.item"
    data-ng-options="item.label for item in main.test.items"
    required="required">
    <option value="" label="What do you want?"></option>
  </select>

</div>

this.test.item selected="selected" ( "B" ), ( ) .

angular
  .module('myApp')
  .controller('MainController', MainController);

function MainController () {

  this.test = {};

  this.test.items = [
    { label : 'A' },
    { label : 'B' },
    { label : 'C' }
  ];

  // Pre-select the second item.
  this.test.item = this.test.items[1];
}

, , ?

, , ?

https://jsfiddle.net/paulhhowells/4hmwhbe8/

+4
2

, , .

@paulhhowells , - . , DOM . , , . , , selected = "selected" , . , .

EDIT: jQuery , " " .

+2

selected .

, option .

https://developer.mozilla.org/en/docs/Web/HTML/Element/option

, Angular DOM, 'selected' <option> ng-options, , .

+1

Source: https://habr.com/ru/post/1623789/