0

$materialDialogAngular Material Designコンポーネントです 。
しかし、そのコンポーネントをどのように使用するのでしょうか? angular-ui ブートストラップのようなものを返さないのはなぜですか? 約束や結果などを取得する方法は、モーダルを閉じるだけですか? 短い例を次に示します。

var test = $materialDialog({
        templateUrl: '/Assets/app/azured/partials/dialog.html',
        targetEvent: event,
        resolve:{
            item: function () {
                return item;
            }
        },
        appendTo: angular.element.find('dialog'),
        controller: ['$scope', '$hideDialog', 'item', function ($scope, $hideDialog, item) {
            $scope.name = item.Name;
            $scope.cancel = function () {
                $hideDialog();
            }
            $scope.ok = function () {
                scope.name = '';
                $hideDialog();
            };
        }]
    });
    test.then(function (x) {
        console.log(x); //this prints destroyDialog function why?
    });

ユーザーが何を押したかはどこでわかりますか? $materialDialog 内にカスタム ロジックを実装する必要がありますか? その場合、私はそれがかなり奇妙だと思います。github 237の問題

4

2 に答える 2

4

これは、よりクリーンなアプローチを示し、Plunker を含むブログ投稿です。

http://angularauthority.com/2015/04/28/creating-a-material-design-modal-service/

于 2015-04-28T23:43:47.340 に答える