Angularjs 从控制器使用$mdDialog stright

Angularjs 从控制器使用$mdDialog stright,angularjs,angular-material,Angularjs,Angular Material,登录失败时尝试使用$mdDialog;目前,我已注入$mdDialog,在响应失败时,我添加了以下代码: $MDD对话框代码: 知道我做错了什么吗 我的错误 我的控制器我不认为有必要,但只需封装: 我的知识非常有限,但我通过在我的登录函数中设置一个单独的函数并从我的else调用它,成功地做到了这一点 function showAlert() { var alert; alert = $mdDialog.alert() .title('Attention,') .

登录失败时尝试使用$mdDialog;目前,我已注入$mdDialog,在响应失败时,我添加了以下代码:

$MDD对话框代码:

知道我做错了什么吗

我的错误

我的控制器我不认为有必要,但只需封装:


我的知识非常有限,但我通过在我的登录函数中设置一个单独的函数并从我的else调用它,成功地做到了这一点

function showAlert() {

    var alert;
    alert = $mdDialog.alert()
    .title('Attention,')
    .content('Incorrect username or password; please try agian!')
    .ok('Close');



    $mdDialog.show( alert )
    .finally(function() { 
       alert = undefined;
    });
}

那么,对话框是否没有显示?或者在其中看不到任何消息?请使用警报变量而不是嵌套调用来尝试。i、 e.创建一个var警报,设置所有详细信息,然后像$mdDialog.showalert那样显示
$mdDialog.alert(...).title(...).textContent is not a function
(function () {
    'use strict';
    angular
        .module('app')
        .controller('authController', authController);

    authController.$inject = ['$scope','$state','AuthService','$mdDialog'];


    function authController($scope,$state,AuthService,$mdDialog) {

        $scope.login = login;
        $scope.user = {email: 'user', pass: 'pass'};

        function login(){

            this.dataLoading = true;

            AuthService.Login(this.user.email, this.user.pass, function (response) {

                console.log(response);

                if (response.success) {

                    $state.go("dashboard");

                } else {

                    $mdDialog.show( $mdDialog.alert().title('Username / password is incorrect').textContent(response.message)
                    .ok('Got it!'));

                }
            });         

        }

    };



})();
function showAlert() {

    var alert;
    alert = $mdDialog.alert()
    .title('Attention,')
    .content('Incorrect username or password; please try agian!')
    .ok('Close');



    $mdDialog.show( alert )
    .finally(function() { 
       alert = undefined;
    });
}