send variables to controller('resolve') in ngDialog

Jah*_*nov 9 angularjs ng-dialog

Simple way of opening modal with ngDialog is this:

ngDialog.open({
    template: 'template.html',
    controller: 'someCtrl'
})
Run Code Online (Sandbox Code Playgroud)

How can I send variables to that 'someCtrl'?

Is there such thing as 'resolve' in ngDialog?

Example from angular-bootstrap modal:

$modal.open({
    template: "<p>This is template</p>",
    controller: "someCtrl",
    resolve: {
        someVar: function(){
            return "Value of someVar"
        }
    }
})
Run Code Online (Sandbox Code Playgroud)

this would open the modal send the 'someVar' to the responsible Controller.

UPDATE:

It seems like new version of ngDialog added this feature:

ngDialog.open({
    controller: function Ctrl(dep) {/*...*/},
    resolve: {
        dep: function depFactory() {
            return 'dep value';
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

dfs*_*fsq 13

好像看起来像ngDialog不支持控制器中的解析和自定义注入.但是,您可以通过controller自己创建实例来手动完成:

ngDialog.open({
    scope: $scope,
    template: 'template.html',
    controller: $controller('someCtrl', {
        $scope: $scope,
        name: 'Thomas'
    })
});
Run Code Online (Sandbox Code Playgroud)

然后在控制器中,您将能够访问注入的服务/变量:

app.controller('someCtrl', function($scope, name) {
    console.log(name); // Thomas
});
Run Code Online (Sandbox Code Playgroud)

然而,这种方法有一个警告,因为当控制器ngDialog本身实例化时,它也会$element在其中注入服务,这是angular.element打开的对话框HTML 的实例(但我怀疑它甚至在控制器中是必要的).但无论如何你应该知道.

演示:http://plnkr.co/edit/3YpQ2bemk8fntKAPWY9i?p=preview