您的位置:首页 > 其它

$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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: