title: Is there any way to use $uibModal and $uibModalInstance in a single controller to implement modal popup using angular with typescript?
body: <p>As I am a newbie in angular with typescript I am facing a issue while implemented angular modal popup. The issue is I have one drop-down on which change I have to open a modal popup and that modal popup will have two buttons "Yes" or "No". For this I have one controller where I have injected a dependency.    </p>
  
  <pre><code>export class QuestionnaireController {
      static ngControllerName = 'questionnaireController';
      static inject = ["$uibModal"];
      constructor(private $uibModal: ng.ui.bootstrap.IModalService) {
      }
       public openModalPopup() {
          let options: ng.ui.bootstrap.IModalSettings = {
              controller: QuestionnaireController,
              controllerAs:'ctrl',
              templateUrl: 'app/views/Dialogbox.html',
  
          };
        this.$uibModal.open(options);
  
      }
  }
  </code></pre>
  
  <p>Most of my code is written in 'QuestionnaireController' and the popup is getting open using this controller but I also want to close this popup so I read a article where it was written that I have to created a new controller "ModalController " to make popup close.</p>
  
  <pre><code>export class ModalController {
      static inject = ["$uibModalInstance"];
      constructor(private $uibModalInstance: ng.ui.bootstrap.IModalServiceInstance) {
      }
      public close() {
          this.$uibModalInstance.close();
      }
  }
  Popup code is here...
  
  &lt;div ng-app="" id="dvModal"&gt;
  &lt;div class="modal-header"&gt;
  
  &lt;/div&gt;
  &lt;div class="modal-body"&gt;
      &lt;p&gt; Evaluated result will be discarded if you continue. Are you sure you want to continue?&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class="modal-footer"&gt;
      &lt;input id="yesBtn" type="button" class="btn btn-default" ng-click="ctrl.Yes('true')" value="Yes" /&gt;
      &lt;input id="npBtn" type="button" class="btn btn-default" ng-click="ctrl.close()" value="No" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>and to close this passed Controller : ModalController in options which makes my popup closed on click of "No". But now the issue is generated here, how I again went to "QuestionnaireController" to do "Yes" functionality as "Yes" functionality is written in QuestionnaireController.</p>