function centerModal(modalobj){
if(modalobj.hasClass('modal')){
modalobj.each(function(i){
var $clone = $(this).clone().css('display', 'block').appendTo('body');
var top = Math.round(($clone.height() - $clone.find('.modal-content').height()) / 2);
top = top > 0 ? top : 0;
$clone.remove();
$(this).find('.modal-content').css("margin-top", top);
});
}
}
$('.modal').on('show.bs.modal', centerModal);
$(window).on('resize', centerModal);
$scope.$watch('step',function(newValue,oldValue, scope){
if(newValue == 1){
var marginTop = (document.documentElement.clientHeight - 186) / 2;
console.log(marginTop);
modalobj.find('.modal-content').css('margin-top', marginTop +'px');
} else {
centerModal(modalobj);
}
});