$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>

 posted on 2016-01-25 11:56  jayruan  阅读(466)  评论(0编辑  收藏  举报