0
我成功添加了一个自定义模板mdDialog
以请求一个名称和一个布尔(从复选框)对话框,点击一个元素时弹出。缩小角度mdDialog控制器代码失败
但是,虽然它在开发中效果很好,但由于构建过程会缩小js代码,因此它在生产上会失败。我在这个问题上发现了很多关于这个问题的例子,但是没有一个强调如何解决我的问题,在大多数情况下,这是一个决心或容易理解的东西。我的代码是:
function DialogController ($scope, $mdDialog, gsheet, name) {
$scope.name = name;
$scope.gsheet = gsheet;
$scope.cancel = function() {
$mdDialog.cancel();
};
$scope.create = function (name, gsheet) {
$mdDialog.hide ({ 'name': name, 'createSheet': gsheet ? gsheet : false });
};
}
function openNewDataSourceDialog (ev) {
if (!$rootScope.driveAuth) {
$rootScope.$emit ('requestMoreAuth');
}
else {
var confirm = $mdDialog.prompt ({
templateUrl: "app/main/data-sources/data-sources-dialog.tmpl.html",
parent: angular.element (document.body),
clickOutsideToClose: true,
targetEvent: ev,
controller: DialogController,
fullscreen: false,
scope: $scope,
preserveScope: true,
locals: {
name: "",
gsheet: true
}
});
$mdDialog.show (confirm).then (function (result) {
//create something...
}, function() {
//dont create anything...
});
}
};
什么是打破这里缩小的想法?谢谢!
谢谢,会尝试。感谢编辑也是有道理的。 :) – geodeath
@geodeath我在2年前有同样的问题:) –
编辑控制器创建与您的编辑,它的作品,但它是一个不错的主意,而不是在属性中。我猜想保持代码更清洁。 :) 谢谢! – geodeath