美好的一天,我在后端使用Angularjs 1.6.4 v和C#,我对这项技术和学习仍然是新手。
问题:我无法在文本字段中输入数据,如下所示。
<div layout="row" layout-xs="column">
<md-input-container class="md-icon-float md-block" flex>
<label>Name</label>
<md-icon md-font-icon="ion-ios-search"></md-icon>
<input ng-model="filter.name" type="text" ng-change="refreshContactTable()" ng-model-options='{ debounce: 500 }'>
</md-input-container>
<md-input-container class="md-icon-float md-block" flex>
<label>Contact No</label>
<md-icon md-font-icon="ion-ios-search"></md-icon>
<input ng-model="filter.contactNo" type="text" ng-change="refreshContactTable()" ng-model-options='{ debounce: 500 }'>
</md-input-container>
<md-input-container flex>
<label>Properties</label>
<md-icon md-font-icon="ion-ios-search"></md-icon>
<input ng-model="filter.property" type="text" ng-change="refreshContactTable()" ng-model-options='{ debounce: 500 }'>
</md-input-container>
</div>
我使用Material angular,因为您可以看到我的输入字段与具有过滤功能的ng-model连接,并且它与资源服务(模型)连接。好的,这是我下面给出的角度代码(忽略属性字段)
$scope.landlordsTable = new ngTableParams(
{
page: 1,
count: 20,
filter: {
name: "",
contactNo: ""
}
},
{
getData: function ($defer, params) {
ContactsResourceService.get({
type: 'Landlord',
name: params.filter().name,
contactNo: params.filter().contactNo,
page: params.page(),
count: params.count()
}, function (data) {
if (data) {
params.total(data.total);
$defer.resolve(data.collection);
}
});
}
});
$scope.refreshContactTable = function () {
$scope.landlordsTable.reload();
}
任何人都可以帮我解决这个问题。谢谢。