本篇文章主要介绍了angularjs引导数据库实现模式对话框,对于爪哇岛描述语言教程感兴趣的同学可以参考一下:在完成一个后台管理系统时,需要用表显示注册用户的信息。但是用户地址太长了,不好显示。所以想做一个模式对话框,点击详细地址按钮时,弹出对话框,显示地址。
效果如下图:
通过查阅资料,选择使用洋淀来实现,洋淀是一个用于Angular.js应用的模式对话框和弹出窗口对话。非常小(?2K),拥有简约的原料药,通过主题高度可定制的,具有唯一的依赖Angular.js。
ngDialog github地址: https://github.com/likeastore/ngDialog
http://likeastore.github.io/ngDialog/洋淀演示:
首先引入需要的洋淀的射流研究…和钢性铸铁文件。
可通过加拿大引入
span style=' font-size :18 px'//cdn js。云耀斑。com/Ajax/libs/ng-dialog/0。3 .7/CSS/Undialog。量滴CSS//cdn js。云耀斑。com/Ajax/libs/ng-dialog/0。3 .7/CSS/Undialog-主题-默认。量滴CSS//cdn js。云耀斑。com/Ajax/libs/ng-dialog/0。3 .7/CSS/un dialog-主题-普通。量滴CSS//cdn js。云耀斑在user.js里的控制器中注入依赖
span style=' font-size :18 px'var用户控制器=角度。模块('用户控制器',[' undi dialog ']);用户控制器。controller(' user controller ',['$scope ',' $http ',$ undi dialog ',function($scope,$http,undi dialog){ $ scope。名称=“用户”;$ scope.user=$ scope.address=//获取用户信息$ http。get(' http://localhost :3000/users ').成功(函数(数据){ $ scope.user=dataconsole。日志($ scope)。用户);});//点击详细地址按钮时,跳出模式对话框$scope.clickToAddress=函数(地址){$scope.address=地址;undi对话框。打开({ template : '视图/测试。html ',//模式对话框内容为测试。html类名: '迪恩对话-主题-普通',scope:$scope //将范围传给test.html,以便显示地址详细信息});};}])/spantest.html(读取范围中的地址并显示,表格样式采用自举)
span style=' font-size :18 px'table class=' table ' t rth收件人姓名/thtd { { address }。名称} }/TD/tr th收件地址/thtd { { address }。内容} }/TD/trtrth手机号/thtd { { address }。phone } }/TD/tr/thead/table/span用户。html(显示用户的信息,当地址不为空时,显示详细地址按钮,并点击按钮时,调用控制器中的单击地址函数)
span style=' font-size :18 px'div class=' panel panel-warning ' div class=' panel-heading '用户管理/div class=' row ' div class=' col-LG-8 '/div class=' col-LG-4 ' div class=' input-group ' input type=' text ' class=' form-control ' placeholder=' Search for.ng-model=' search ' span class=' input-group-BTN ' button class=' BTN BTN-default ' type=' button ' go!/button/span/div/div/div table class=' table '该姓名/th余额span class=' glyphicon glyphicon-flash ' aria-hidden=' true '/span/thth头像/th默认地址/th操作/th/dtbodytr ng-repeat=' user | filter :搜索中的用户TD { {用户。username } }/tdtd { { user。剩余支付} }/tdtd ng-if=' user。网址!=' undefined ' ' { { user。URL } }/tdtd ng-if=' user。URL=='未定义' '系统默认头像/tdtd ng-if=' user。地址。长度==0 '暂无默认地址/tdtd ng-if=' user。地址。长度!=0 ' ng-repeat='用户中的地址。地址' ng-click=' clickToAddress(地址)'按钮类型='按钮'=' BTN BTN-信息导航条-BTN '详细地址/button/TDT按钮类型=' button ' class=' BTN BTN-警告导航条-BTN ' ng-click=' remove(用户_id)'删除/button/TD/tr/t正文/表格/div/div/span以上所述是小编给大家介绍的BootStrap Angularjs NgDialog实现模式对话框,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对我们网站的支持!