我尝试使用md对话框要求用户确认使用购买功能:
HTML
<md-button ng-click="showConfirm($event, 'buy')" style="background-color: #2196f3; width:45%; "><b>BUY NOW</b></md-button>
和JS
$scope.status = ' ';
$scope.customFullscreen = $mdMedia('xs') || $mdMedia('sm');
$scope.showConfirm = function(ev, type) {
// Appending dialog to document.body to cover sidenav in docs app
var confirm = $mdDialog.confirm()
.title('WOULD YOU LIKE TO BUY/SELL NOW?')
.textContent('This will place a market order and charge a 1% Luno fee.')
.ariaLabel('Lucky day')
.targetEvent(ev)
.ok('Confirm')
.cancel('Decline');
$mdDialog.show(confirm).then(function(){
if (type === "buy") {
$scope.buy(0,true);
} else {
$scope.sell(0,true);
}
});
}
对话框工作正常,购买和销售确认,但风格搞砸了,显示标题,确定并取消为白色,所以你无法看到它。只有textContent是黑色的。据我了解,它应该从默认的东西中获得它的样式,那么为什么它看起来不像Angular演示页面上的对话框?