【问题标题】:Angular confirmation box style角度确认框样式
【发布时间】:2016-12-30 10:32:00
【问题描述】:

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

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;
    });
  }
}

再次提醒,我登录后立即开始使用此功能,无需按下按钮或其他任何东西,自动。

有什么帮助吗?

【问题讨论】:

标签: javascript css angularjs confirmation


【解决方案1】:
//---------------------------------------------------------------------------------------------------------------

# 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');
            );
        }
    );
}

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-04
    • 2019-05-11
    • 2019-04-23
    • 1970-01-01
    • 2019-12-18
    • 2020-02-14
    • 1970-01-01
    相关资源
    最近更新 更多