$modal
2016-01-25 11:56
507 查看
$scope.open = function (size,data) {
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: ModalInstanceCtrl,
size: size,
resolve: {
items: function () {
return data;
}
}
});
modalInstance.result.then(function (selectedItem) {
alert("11111")
}, function () {
alert("2222222222222")
});
};
var ModalInstanceCtrl = function ($scope, $modalInstance, items) {
if(items.type=="ADD_POINTS"){
$scope.title="ADD POINTS:"+items.points;
}
$scope.ok = function () {
$modalInstance.close(items);
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
};
<script type="text/ng-template" id="myModalContent.html">
<div class="modal-header">
<h3 class="modal-title">I'm a modal!</h3>
</div>
<div class="modal-body">
<b>{{ title }}</b>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="ok()">OK</button>
<button class="btn btn-warning" ng-click="cancel()">Cancel</button>
</div>
</script>
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: ModalInstanceCtrl,
size: size,
resolve: {
items: function () {
return data;
}
}
});
modalInstance.result.then(function (selectedItem) {
alert("11111")
}, function () {
alert("2222222222222")
});
};
var ModalInstanceCtrl = function ($scope, $modalInstance, items) {
if(items.type=="ADD_POINTS"){
$scope.title="ADD POINTS:"+items.points;
}
$scope.ok = function () {
$modalInstance.close(items);
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
};
<script type="text/ng-template" id="myModalContent.html">
<div class="modal-header">
<h3 class="modal-title">I'm a modal!</h3>
</div>
<div class="modal-body">
<b>{{ title }}</b>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="ok()">OK</button>
<button class="btn btn-warning" ng-click="cancel()">Cancel</button>
</div>
</script>
相关文章推荐
- BCD 码的应用
- 80x86汇编编程两题
- 在WPF中使用PlaneProjection模拟动态3D效果
- 双向流水灯的最简单程序
- CRC 的应用
- 彩虹文字--RainbowText
- 十进制586用格雷码表示是多少?
- CRC 的简介
- 直接写屏
- 找出所有n的平方具有对称性质(也称回文数)的数
- 80x86汇编语言编程--
- 51单片机汇编语言--延时程序的延时时间
- 用80x86汇编语言编程:输入字符串,并把大写字符转为小写再输出
- 用80x86汇编语言编程--用递归方法求阶乘
- WC联合训练总结
- tomcat 加 gzip 压缩
- [问题记录] openssl error:0906D064:PEM routines:PEM_read_bio:bad base64 decode
- 淘宝双飞翼布局,两边固定中间自适应布局。中间内容先显示。
- SSH端口转发
- SpringMVC实战