Dialog Service

1 篇文章 / 0 new
author
Dialog Service
https://github.com/m-e-conroy/angular-dialog-service , http://codepen.io/m-e-conroy/pen/rkIqv 其內部結合 Angular-Translate 實現多語系功能.
幾種使用方式
$scope.launch = function(which) {
    switch (which) {
        case 'error':
            dialogs.error('標題', '錯誤訊息');
            break;
        case 'wait':
            var dlg = dialogs.wait(undefined, undefined, _progress);
            _fakeWaitProgress();
            break;
        case 'notify':
            dialogs.notify('標題', '訊息通知');
            break;
        case 'confirm':
            var dlg = dialogs.confirm('標題', '是否作業');
            dlg.result.then(function(btn) {
                $scope.confirmed = 'You confirmed "是"';
            }, function(btn) {
                $scope.confirmed = 'You confirmed "否"';
            });
            break;
        case 'custom':
            var dlg = dialogs.create('/dialogs/custom.html', 'customDialogCtrl', {}, {size: 'lg', keyboard: true, backdrop: false, windowClass: 'my-class'});
            dlg.result.then(function(name) {
                $scope.name = name;
            }, function() {
                if (angular.equals($scope.name, ''))
                    $scope.name = 'You did not enter in your name!';
            });
            break;
        case 'custom2'://給初值
            var dlg = dialogs.create('/dialogs/custom2.html', 'customDialogCtrl2', $scope.custom, {size: 'lg'});
            break;
    }
}; 
Free Web Hosting