0

I have implemented popup / modal window in mobile browser using angular js.

I have used modal directive for this which is given in angular js with bootstrap site.

I have kept all the content of popup in a variable and while opening popup, I am passing that variable to in element to following function:

$scope.open = function (size, element) {
        var modalInstance = $modal.open({
          controller: ModalInstanceCtrl,
          template : element,
          size: size
        });
    };

I have also added a ng-click event in that content of popup which is stored in the variable.

But that ng-click function is not working.

Please give me some solution.

7
  • You need to include all of the relevant code. I only see a small bit of the code you mention in your question. Commented Sep 18, 2014 at 5:25
  • better create a plunk. Commented Sep 18, 2014 at 5:39
  • I want to close window on click of an element present in window. Commented Sep 18, 2014 at 6:04
  • please find code at: plnkr.co/edit/Y8BvvxZByioxrb1cyr1J?p=preview Commented Sep 18, 2014 at 6:05
  • Is your template a html code? Commented Sep 18, 2014 at 6:07

1 Answer 1

1

To close that modal window all you need to do is call the same code what is written for cancel or simply call cancel only,from your template.

$scope.cancel = function () {
    $modalInstance.dismiss('cancel');
  };

This is the way you can close your window I edited your plunker and now its working I just called cancel method from template. Here is updated plunker

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.