Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

$mdDialog: bindToController not working? Possibly needs more docs too #1534

@epelc

Description

@epelc

I was trying to use $mdDialogs bindToController option but it doesn't appear to be working. I checked $scope.myLocal this.myLocal and $scope.ctrl.myLocal but none of them seem to be populated. I also logged the scope it didn't have anything related to my local objects.

I checked $scope.ctrl.myLocal because I found this test which appears to do that but it didn't work.

Also the docs on this are a bit vague they simply say the locals will be copied to the controller. Perhaps a demo using bindToController would be helpful.

Example trying to use `bindToController

$mdDialog.show({
            targetEvent: event,
            locals: {
                Invoice: {...} // I pass a var here
            },
            bindToController: true,
            controller: function($scope, $mdDialog) {
               // Nothing seems to have my invoice object
                console.log('Invoice:', this, $scope.Invoice, $scope.ctrl)
                $scope.done = function() {
                    $mdDialog.hide()
                }
            }
        })

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions