当前位置: 首页 > 工具软件 > Angucomplete > 使用案例 >

AngularJS的angucomplete-alt

吴鸿彩
2023-12-01

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() {
            ... ...
        }

 

angucomplete-alt 文档

转载于:https://www.cnblogs.com/miny-simp/p/7667709.html

 类似资料: