title: Knockout.js options binding not working inside ViewModel
body: <p>I'm trying to bind values from observabeArray to select element. This observable array is the part of view model that binding to table with foreach. Unfortunately it's not working - I got just two empty elements.</p>
  
  <p><strong>JavaScript/jQuery:</strong></p>
  
  <pre><code>&lt;script&gt;
          // heres what we are going to use for binding parameters
          var Roles = function (name, id) {
              this.Role = name;
              this.id = id;
          };
          var Sexes = function (name, id) {
              this.Sex = name;
              this.id = id;
          }
          function UsersViewModel() {
              //This is array values that I want to bind to select
              rolex: ko.observableArray([
                  new Roles("Admin", 3),
                  new Roles("User", 1),
                  new Roles("Operator", 2)
              ]);
              sexx: ko.observableArray([
                  new Sexes("Муж", 1),
                  new Sexes("Жен", 0)
              ]);
              var self = this;
              //self.Id = ko.observable();
              //self.Login = ko.observable("");
              //self.Password = ko.observable("");         
              //self.Role = ko.observable();
              //self.Sex = ko.observable();           
              //var user = {
              //    Id: self.Id,
              //    Login: self.Login,
              //    Password: self.Password,
              //    Role: self.Role,
              //    Sex: self.Sex
              //};
              self.user = ko.observable();
              self.users = ko.observableArray();         
              var baseUri = '/api/users';
              $("#adduser").click(function () {
                  var json = '{"Login":"' + $("#login").val() + '", "Password":"' + $("#password").val() + '", Sex":' + $("#_sex option:selected").val() + ', "Role":' + $("#_role option:selected").val() + '}';
                  $.ajax({
                      url: baseUri,
                      cache: false,
                      type: 'POST',
                      contentType: 'application/json; charset=utf-8',
                      data: json,
                      success: function (data) {
                          $("#notification").text("Пользователь успешно добавлен!");
                          $('#notification').removeClass("hidden");
                          self.users.push(data);
                          setTimeout(function () {
                              $('#notification').addClass("hidden");
                          }, 3000);
                      }
                  });
              });
              self.remove = function (user) {
                  $.ajax({ type: "DELETE", url: baseUri + '/' + user.Id })
                      .done(function () {
                          $("#notification").text("Пользователь успешно удален!");
                          $('#notification').removeClass("hidden");
                          self.users.remove(user);
                          setTimeout(function () {
                              $('#notification').addClass("hidden");
                          }, 3000);
                      });
              }
              self.update = function (user) {
                  $.ajax({ type: "PUT", url: baseUri + '/' + user.Id, data: user })
                  .done(function () {
                      $("#notification").text("Изменения сохранены!");
                      $('#notification').removeClass("hidden");
                      setTimeout(function () {
                          $('#notification').addClass("hidden");
                      }, 3000);
                  });
              }
              $.getJSON(baseUri, self.users);
          }
          $(document).ready(function () {
              ko.applyBindings(new UsersViewModel());
          })
      &lt;/script&gt;
  
  
  And here is table that show all data including mentioned selects.
  </code></pre>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;table class="pure-table"&gt;
                  &lt;thead&gt;
                      &lt;tr&gt;
                          &lt;td&gt;&lt;/td&gt;
                          &lt;td&gt;#&lt;/td&gt;
                          &lt;td&gt;Логин&lt;/td&gt;
                          &lt;td&gt;Пароль&lt;/td&gt;
                          &lt;td&gt;Роль&lt;/td&gt;
                          &lt;td&gt;Пол&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/thead&gt;
                  &lt;tbody data-bind="foreach: users"&gt;
                      &lt;tr&gt;
                          &lt;td&gt;
                              &lt;input type="button" value="Сохранить" data-bind="click: $root.update" class="pure-button" /&gt;
                              &lt;input type="button" value="Удалить" data-bind="click: $root.remove" class="pure-button" /&gt;
                          &lt;/td&gt;
                          &lt;td data-bind="text: $data.ID"&gt;&lt;/td&gt;
                          &lt;td&gt;
                              &lt;input type="text" data-bind="value: $data.Login" /&gt;
                          &lt;/td&gt;
                          &lt;td&gt;
                              &lt;input type="text" data-bind="value: $data.Password" /&gt;
                          &lt;/td&gt;
                          &lt;td&gt;
                              &lt;select data-bind="options: rolex, optionsText: 'Role'"&gt;
                              &lt;/select&gt;
                          &lt;/td&gt;
                          &lt;td&gt;
                              &lt;select id="sex" data-bind="options: sexx, optionsText: 'Sex'"&gt;
                              &lt;/select&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/tbody&gt;
              &lt;/table&gt;
  </code></pre>