如何根据条件申请类isErrored
是true
or false
。
以下代码不起作用:
$scope.addWork = function() {
var isErrored = false;
$rootScope.$on('isErrored', function(event, data) {
alert(data);
if(data == true)
isErrored = true;
});
ngDialog.open({
scope: $scope,
template: 'addWorkingDialog',
controller: 'addWorkingController',
className: isErrored ? 'ngdialog-theme-default
alertmsgDialog' : 'ngdialog-theme-default workingDialog'
});
};