Angularjs中的ui-bootstrap的使用教程

1.新建uiBootstrap.html页面,引入依赖的js和css类库

成都创新互联公司服务项目包括蔡家坡网站建设、蔡家坡网站制作、蔡家坡网页制作以及蔡家坡网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,蔡家坡网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到蔡家坡省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

2.新建uiBootstrap.js文件,定义一个uiModule 模块,引入依赖的模块

/**
 * Created by zhong on 2015/9/7.
 */
var uiModule = angular.module("uiModule",["ui.bootstrap","ui.router"]);
});

3.定义dialog弹出窗口的模板

4.定义一个 UiController,并声明一个用于打开dialog弹出框的函数openDialog

uiModule.controller("UiController",function($scope,$modal){
//打开dialog的函数
$scope.openDialog = function(){
$modal.open({
  templateUrl:"myModalContent.html",//dialog的id,与html建立的template的id一致
controller:"ModalController"//指定dialog的controller
});
 };
})

5.定义dialog弹出框的 ModalController

这个controller中声明弹出框中确认和取消按钮的单击事件的处理函数

controller("ModalController",function($scope, $modalInstance){
//定义dialog中的确认按钮的点击事件的处理函数
$scope.ok = function(){
$modalInstance.close();//
};
//定义dialog中的取消按钮的点击事件的处理函数
$scope.cancel = function(){
$modalInstance.dismiss('cancel');
 }
});

5.在uiBootstrap.html文件中添加一个按钮,用于打开窗口

6.效果

Angularjs中的ui-bootstrap的使用教程

补充:

Angularjs中的ui-bootstrap的使用教程

以上所述是小编给大家介绍的Angularjs中的ui-bootstrap的使用教程,希望对大家有所帮助!


网站题目:Angularjs中的ui-bootstrap的使用教程
转载源于:http://scyanting.com/article/gjpise.html