2016-03-04 51 views
0

下面的代码不能处理缩小,这看起来很明显(控制器依赖性在缩小后不会工作)。有人可以提出一个理想的方法来写下面的代码,这个代码也适用于缩小。只是为了您的信息,我正在使用打字稿,而我并不打算为控制器创建新的类或功能,因为它非常小,所以我更愿意编写内联块。在此先感谢..缩小后的角码不工作

public openSpinModal(): void { 
      if (!this.spinModalInstance) { 
       this.marsAction.closeModal(); 
       this.isNeedToClsoe = false; 
       this.spinModalInstance = this.$modal.open({ 
        animation: true, 
        templateUrl: 'module/common/components/mars-modal/spinModalContent.html', 
        size: 'sm', 
        windowClass: "modal-vertical-centered", 
        controller: ($scope, $modalInstance) => { 
         this.marsAction.closeModal =() => { 
          $modalInstance.close(); 
          this.isNeedToClsoe = true; 
         }; 
        } 
       }); 

       //removed code to keep question cleraner 
      } 
     } 

回答

0

下面的代码为我工作 -

public openSpinModal(): void { 
       if (!this.spinModalInstance) { 
        this.marsAction.closeModal(); 
        this.isNeedToClsoe = false; 
        this.spinModalInstance = this.$modal.open({ 
         animation: true, 
         templateUrl: 'module/common/components/mars-modal/spinModalContent.html', 
         size: 'sm', 
         windowClass: "modal-vertical-centered", 
         controller: ["$scope", "$modalInstance" , ($scope, $modalInstance) => { 
          this.marsAction.closeModal =() => { 
           $modalInstance.close(); 
           this.isNeedToClsoe = true; 
          }; 
         } 
        }]); 

        //removed code to keep question cleraner 
       } 
      }