标签:
<grid-filter varible="info.M_id" on-change="searchMember()">
</grid-filter>
指示
app.directive("gridFilter", function () {
return {
scope: {
varible: "=",
onChange: "&"
},
template: [
'<div class="input-append input-group">',
'<input class="form-control border-right-0" ng-change="onChange();" no-special-char class="form-control" ng-model="varible" />',
'<div class="input-group-append">',
' <span class="input-group-text"><i class="fa-filter fa" aria-hidden="true"></i></span>',
' </div>',
' </div>'].join("")
};
})
控制器
$scope.searchMember = function () {
var data = $scope.info;
Request.GetTabledata("SearchMemberData", data, null, $scope, true);
}
例如,在文本框上键入时hello
。控制器不会$scope.info.M_id
在第一次更改时绑定。假设我输入h
,e
然后$scope.info.M_id
只绑定h