2017-10-02 2 views
0

저는 앵글 스트랩과 함께 특별히 모달로 작업 중이며 코딩하는 동안 this 스타일을 사용하고 있습니다. 모달의앵글 스트랩 모달 스코프

function parentController($scope, $routeParams, $location, $modal) { 
    var vm = this; 
    vm.message = ''; 
... 

은 HTML 부분 : 내 컨트롤러의 일부입니다

<div class="modal" tabindex="-1" role="dialog" aria-hidden="true"> 
    <div class="modal-dialog"> 
     <div class="modal-content"> 
      <div class="modal-header" ng-show="title"> 
       <button type="button" role="button" class="close" aria-label="Close" ng-click="$hide()"><span aria-hidden="true">&times;</span></button> 
       <h1 class="modal-title" ng-bind="title"></h1> 
      </div> 
      <div class="modal-body" ng-bind-html="content"> 
      </div> 
      <div class="modal-footer"> 
       <button type="button" class="btn btn-success pull-left" ng-click="$hide();parentController.f1();" aria-label="Close">yes</button> 
       <button type="button" class="btn btn-danger pull-left" ng-click="$hide();parentController.f2();" aria-label="Close">no</button> 
      </div> 
     </div> 
    </div> 
</div> 

그리고 컨트롤러 내 모달 정의입니다 : 내가 접근에 갈거야, 지금

var modalObject = { 
       scope: $scope, 
       templateUrl: 'path/to/modal.html', 
       title: 'desc', 
       content: '<p>enter description here</p> <textarea ng-model="parentController.message" class="form-control" rows="10"></textarea>', 
       show: false 
      }; 

$modal(modalObject); 

parentController의 메시지 값에 추가합니다. f2 함수에 을 기록 할 때 그대로 비어 있습니다. 액세스 할 수있는 솔루션은 무엇입니까?

답변

0

마지막으로 컨트롤러에서 내용을 제거하고이를 수동으로 html 코드에 추가하여 문제를 해결했습니다.

var modalObject = { 
       scope: $scope, 
       templateUrl: 'path/to/modal.html', 
       title: 'desc', 
       show: false 
      }; 

$modal(modalObject); 

모달의 HTML 코드 : 그래서

<div class="modal" tabindex="-1" role="dialog" aria-hidden="true"> 
    <div class="modal-dialog"> 
     <div class="modal-content"> 
      <div class="modal-header" ng-show="title"> 
       <button type="button" role="button" class="close" aria-label="Close" ng-click="$hide()"><span aria-hidden="true">&times;</span></button> 
       <h1 class="modal-title" ng-bind="title"></h1> 
      </div> 
      <div class="modal-body"> 
       <p>enter description here</p> 
       <textarea ng-model="parentController.message" class="form-control" rows="10"></textarea> 
     </div> 
      <div class="modal-footer"> 
       <button type="button" class="btn btn-success pull-left" ng-click="$hide();parentController.f1();" aria-label="Close">yes</button> 
       <button type="button" class="btn btn-danger pull-left" ng-click="$hide();parentController.f2();" aria-label="Close">no</button> 
      </div> 
     </div> 
    </div> 
</div> 

, 내 모델에서 텍스트 영역의 값이