HTML:
1 <div angucomplete-alt 2 id="teacherName" 3 placeholder="查询" 4 pause="500" 5 selected-object="selectedTeacher" 6 remote-url-data-field="" 7 remote-api-handler="searchTeacher" 8 title-field="name,deptName,userId" 9 description-field="name,deptName,userId" 10 text-no-results="未找到,请手动添加" 11 minlength="1" 12 input-class="form-control" 13 match-class="highlight"> 14 </div>
JS:
/** * 搜索 */ $scope.searchTeacher = function(userInputString, timeoutPromise) { ... ... }; ... ... /** * 选中 */ $scope.selectedTeacher = function(selected) { ... ... $scope.addTeacher(); $scope.$broadcast('angucomplete-alt:clearInput'); //清空input }; /** * 添加 */ $scope.addTeacher = function() { ... ... }