【发布时间】:2018-04-14 14:18:17
【问题描述】:
<body>
<div ng-app="mvcapp" ng-controller="AngularController">
<input type="text" class="myInput form-control" name="txtStorename" id="txtStorename" placeholder="Search for Store.." title="Type in a Store" data-error-message="Please enter StoreName" ng-model="sname" >
<ul id="myUL" ng-repeat="StoreList in Store| filter:{StoreName:sname}">
<li ng-click="SelectedValue(StoreList.StoreName)">{{StoreList.StoreName}}</li>
</ul>
<div ng-show="(Store|filter:sname).length==0" style="color:red;font-weight:bold">No Result Found</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.js"></script>
<script>
var angular = angular.module('mvcapp', []);
angular.controller('AngularController', function ($scope, $http) {
Getallitem()
function Getallitem() {
$http.get('/Coupons/GetStore').success(function (data) {
$scope.Store = data;
});
}
$scope.SelectedValue = function (item) {
document.getElementById("txtStorename").value = item;
}
});
</script>
</body>
【问题讨论】:
-
请解释您面临的问题!
-
先生列表在表单加载时弹出。在加载时文本框下方有一个下拉列表。我想要的是列表应该显示在文本框的 keyup 事件中。我找不到解决方案来做到这一点
标签: javascript c# angularjs asp.net-mvc model-view-controller