角度确认框样式 [英] Angular confirmation box style

查看:43
本文介绍了角度确认框样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

登录我在Angularjs中制作的应用程序后,第一步是初始功能显示确认框.那是常规的确认框,没有任何样式.我的问题是,如果我的功能是:

After I login in my app which I made in Angularjs, first step is that initial function show confirmation box. That is regular confirmation box, without any style. My question is how I can stylize that box with CSS, and add some text too, if my function is :

function versionCheck() {
  if ($window.confirm("Are you sure?")) {
    vm.starting = true;
    dataService.restartVersion()
        .then(function onSuccess(data) {
            vm.data = data.response;
        }).catch(function onReject(response) {
    }).finally(function () {
        vm.starting = false;
    });
  }
}

再次提醒我,登录后我会立即开始使用此功能,而无需按下按钮或自动进行其他操作.

Again I will remind that I immediately start with this function after login, without press button or something else, automatically.

有帮助吗?

推荐答案

//---------------------------------------------------------------------------------------------------------------

# This is the Angular Material Design way of customizing dialog boxes.
# $mdDialog.confirm() and $mdDialog.show will solve this issue.
# I would create a totally different function to handle the dataService
# And have the versionCheck() just handling the confirmation dialog
# as shown below.

function versionCheck() {
    var confirm = $mdDialog.confirm()
        .title('Cancel confirmation')
        .textContent('Are you sure?')
        .ariaLabel('Are you sure?')
        .ok('Ok')
        .cancel('Cancel');

    $mdDialog.show(confirm).then(
        function() {
            $state.go('login');
            );
        }
    );
}

//---------------------------------------------------------------------------------------------------------------

这篇关于角度确认框样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆