您好我安装了以下模块https://github.com/likeastore/ngDialog
它工作得很好,但我不知道如何从控制器打开对话框,我这样做:
var app = angular.module('app', ['ngRoute','ngAnimate','ngSanitize','ngDialog']);
app.controller('SignupController', function($rootScope,$scope) {
$scope.signup = function(){
var error = false,
error_list = "ERRORS";
if(!$scope.signup_username){
error = true;
error_list += "\n\n Username \n " + $rootScope.errors.required_field;
}if(!$scope.signup_email){
error = true;
error_list += "\n\n Email \n " + $rootScope.errors.valid_email;
}if(!$scope.signup_password){
error = true;
error_list += "\n\n Password \n " + $rootScope.errors.required_field;
}
if(error){
ngDialog.open({template:error_list,plain:true});
}else{
//register
}
}
});
但它没有按预期工作,因为我得到控制台错误:ngDialog is not defined。