无法显示关于Drop Down Angular Js

时间:2017-12-13 05:55:31

标签: html css angularjs

我有一个问题似乎是我的下拉并没有在我选择适当的选择时显示数据。选择有两种选择。

CSHTML

<ui-select ng-model="ctrl.requestType" theme="selectize" title="Choose type of requisition" style="min-width: 140px;">

  <ui-select-match placeholder="Select type of requisition">
    <span ng-bind="$select.selected.name"></span>
  </ui-select-match>

  <ui-select-choices repeat="existingRequestType.name as existingRequestType in ctrl.existingRequestTypes | filter: $select.search">

    <span ng-bind-html="existingRequestType.name| highlight: $select.search"> - 
       </span>
  </ui-select-choices>
</ui-select>

Angular.JS格式

app.controller('myCtrl', function($scope, $http, $timeout, $interval) {
      vm.existingRequestTypes = [{
          name: 'Purchase'
        },
        {
          name: 'Lease'
        }
      ];
    }

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

我很确定你忘了定义vm

app.controller('myCtrl', function($scope, $http, $timeout, $interval) {
  var vm = this;

  vm.existingRequestTypes = [{
      name: 'Purchase'
    },
    {
      name: 'Lease'
    }
  ];
}

app.controller('myCtrl', function($scope, $http, $timeout, $interval) {
  $scope.existingRequestTypes = [{
      name: 'Purchase'
    },
    {
      name: 'Lease'
    }
  ];
}