自动完成还是原来的 bassistance.de 好用,详细用法参考官网。

angular的js paths配置及依赖关系不多说;

        'jquery': 'static/jquery-1.11.3/jquery.min',
'jqueryMig': 'static/jquery-migrate-1.4.1.min',
'autocomplete': 'static/jquery-autocomplete/jquery.autocomplete',
 'autocomplete':{deps:['jquery','jqueryMig']

angular页面:

        <div class="form-row">
<label class="label">用户编号</label>
<input type="text" class="form-control" id="idUsrNo" placeholder="输入编号检索">
<span>{{data.Code}}</span>
</div>

页面全部加载后,触发ready事件:

<div ng-repeat="x in [0]" ng-ready=""></div>

前端angular页面全部load后绑定autocomplete组件:

        $scope.$on('ready', function () {
// $('#ui-role').selectpicker();
$('#idUsrNo').autocomplete('/Service1.svc/getsup', {
minChars: 0,
width: 233,// 下拉提示框的宽度
multiple: false,// 多选
matchContains: true,
autoFill: false,
parse: function(data) {// 数据先经过这里数据转换,再格式化formatItem
return $.map(eval(data), function(row) {
return {
data: row,// 传递原始数据
value: row.code + row.label,// 文本框输入的内容于value内容进行匹配过滤
result: row.label// 选择回车后文本框内显示的内容
}
});
},
formatItem: function(row, i, max) {
return row.code + " [" + row.label + "]";// 下拉提示框内显示的内容
}
}).result(function(event, data){
$scope.data.Code = data.code;
$scope.$apply();// 用$apply来强制刷新数据
console.log(data);// 回车后选中的记录
});
});

后台接口是wcf:q是文本框输入的查询条件

        [OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json)]
List<m_supplier> GetSup(string q);

enginx代理转发配置:不区分大小写

        location ~* /Service1.svc/ {
proxy_pass http://localhost:1735;
}

效果:

angular 之 jquery-autocomplete的更多相关文章

  1. jQuery AutoComplete 自动补全

    jQuery.AutoComplete是一个基于jQuery的自动补全插件.借助于jQuery优秀的跨浏览器特性,可以兼容Chrome/IE/Firefox/Opera/Safari等多种浏览器. 特 ...

  2. jquery autocomplete插件

    jquery autocomplete插件 https://goodies.pixabay.com/jquery/auto-complete/demo.html autocomplete-table ...

  3. jquery.autocomplete 模糊查询 支持分组

    //demo <!DOCTYPE html><html> <head> <meta charset="UTF-8"> <lin ...

  4. 使用jQuery Autocomplete(自动完成)插件

    jQuery 的Autocomplete(自动完成.自动填充)插件有不少,但比较下来我感觉,还是bassistance.de 的比较强大,我们就来写一些代码感受一下. 最简单的Autocomplete ...

  5. jquery autocomplete实现读取sql数据库自动补全TextBox

    转自我本良人 原文 jquery autocomplete实现读取sql数据库自动补全TextBox 项目需要这样子一个功能,其他部门提的意见,只好去实现了哦,搞了好久才弄出来,分享一下. 1.前台页 ...

  6. Bootstrap Typeahead/Jquery autocomplete自动补全

    使用Bootstrap Typeahead 组件: Bootstrap 中的 Typeahead 组件就是通常所说的自动完成 AutoComplete,自动填充. 效果如图所示: 实现方式: 1.引入 ...

  7. [Jquery] Jquery AutoComplete的使用方法实例

    jQuery的Autocomplete(自动完成.自动填充)插件 jquery-autocomplete配置: <script type="text/javascript" ...

  8. JQuery UI Autocomplete与jquery.autocomplete.js

    程序中要把一个select改成可以下拉搜索的,就想到了使用下autocomplete.js大概是这么个东西. 问了下同学,推荐我使用Jquery Ui autocomplete,下载下来开始调试使用, ...

  9. paip.提升效率--数据绑定到table原理和流程Angular js jquery实现

    paip.提升效率--数据绑定到table原理和流程Angular js  jquery实现 html #--keyword 1 #---原理和流程 1 #----jq实现的代码 1 #-----An ...

  10. [转]jQuery.Autocomplete实现自动完成功能(详解)

    本篇文章除了介绍jquery.autocomplete基本参数外,主要说明jquery.autocomplete的数据源的格式问题.     1.jquery.autocomplete参考地址 htt ...

随机推荐

  1. django drf安装和doc生成

    1.打开drf官网https://www.django-rest-framework.org/,把相关的包pip install 2.INSTALLED_APPS添加drf 3.url配置 4.tes ...

  2. Spring Boot - Spring Cache

    缓存 服务器自身(内存)的缓存 利用java程序中的变量 简单 集群环境中多个实例无法共享同步 缓存服务器(一般支持集群.分布式) Redis Memcached Spring中使用注解使用缓存 启动 ...

  3. C#连接SQL server数据库

    C#连接SQL server数据库 创建一个Windows应用程序,在窗体中添加TextBox控件.Button控件.Label控件. private void button1_Click(objec ...

  4. LightOJ 1234 Harmonic Number(打表 + 技巧)

    http://lightoj.com/volume_showproblem.php?problem=1234 Harmonic Number Time Limit:3000MS     Memory ...

  5. 爬虫开发5.requests模块的cookie和代理操作

    代理和cookie操作 一.基于requests模块的cookie操作 引言:有些时候,我们在使用爬虫程序去爬取一些用户相关信息的数据(爬取张三“人人网”个人主页数据)时,如果使用之前requests ...

  6. python index()函数

    python内置index()函数 index() 方法检测字符串中是否包含子字符串 str ,如果指定 beg(开始) 和 end(结束) 范围,则检查是否包含在指定范围内,该方法与 python ...

  7. Java反射机制与工厂模式

    工厂模式属于创建型模式,它提供了一种创建对象的最佳方式. 它的特点是:客户端的程序类不直接牵扯到对象的实例化管理,只与接口发生关联,通过工厂类获取指定接口的实例化对象. 简单工厂模式如下: inter ...

  8. [Winter Vacation] 语文实词虚词练习册答案

    下载通道: [120个文言文实词小故事] [18个文言文虚词小故事] 120个文言文实词小故事 爱   楚人爱(宠爱)其子,虽爱(吝惜)钱财,于其子之求而无不应.其子成人,有陶氏之风独爱(喜爱)菊,众 ...

  9. file.delete()的优化

    //删除暂存的pdf File file =new File(pdfFilename); file.delete(); Path path2 = Paths.get(pdfFilename); Fil ...

  10. Python2和Python3共存,pip共存

    使用python开发,环境有Python2和 python3 两种,有时候需要两种环境切换使用,下面提供详细教程一份. 1.下载python3和python2 进入python官网,链接https:/ ...