6

I have an Angular app and am using Angular-Material among other components. Is it possible to open an Angular Tab Dialog with a TemplateUrl being lazy loaded which contains an Angular form? How would you reference this form if at all possible? Here is some code I use to open the dialog:

    $scope.showTabDialog = function(ev) {

        $mdDialog.show({
                controller: DialogController,
                templateUrl: 'pages/properties/tabDialog.tmpl.html',
                parent: angular.element(document.body),
                targetEvent: ev,
                clickOutsideToClose:true
            })
            .then(function(answer) {
                $scope.status = 'You said the information was "' + answer + '".';
            }, function() {
                $scope.status = 'You cancelled the dialog.';
            });
    };

Any Help would be appreciated, thank you

1
  • so what's the problem here? Commented Feb 3, 2016 at 13:58

1 Answer 1

3

Not sure I understand your question correctly but for basic use, pass in your context to locals and return your info to $mdDialog.hide

    $mdDialog.show({
      targetEvent: $event,
      template: dialogContent,
      controller: 'DialogController',
      locals: { info: $scope.info }
    }).then(function(info) {
        if(info) {
          $scope.info.userName = info.userName;      
        }
      });

...

$mdDialog.hide(info);

See this Code Pen:

http://codepen.io/anon/pen/BjqzJR

Sign up to request clarification or add additional context in comments.

4 Comments

@johan did that answer your question?
Hi guys, please accept my apologies for late reply, i have been working on another project and have only been able to come back to this problem now. I think this is exactly what I need and I will test your answer with my project. Thank you, I will revert if it worked for me.
Thank you, you sent me in the right direction. It is working now
Ah, I'm stuck now binding the info variable to the form elements inside the dialog box

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.