3
내 버튼 체크 박스를 부트 스트랩 모달로 체크하면 콘솔에 텍스트 상자의 값을 인쇄하려고합니다. 하지만 내 텍스트 상자는 정의되지 않은 값을 반환합니다. 모든 코드가 완벽하게 작동하는 것 같습니다. 모달은 자체 컨트롤러, 따라서 자신의 범위, 당신은 기능을 실행할 때AngularJS textbox가 정의되지 않은 값을 반환합니다.
는 $ 범위를 경고하기 위해 시도 '확인'을하도록 설정되어 있기 때문에
이
링크 Plunker<!doctype html>
<html ng-app="app" ng-controller="ModalDemoCtrl">
<head>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.js"></script>
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.11.0.js"></script>
<script src="example1.js"></script>
</head>
<body>
<div ><button class="btn btn-default" ng-click="open('lg')" >Large modal</button>
<script type="text/ng-template" id="myModalContent">
<div class="modal-header">
<h3 class="modal-title">I'm a modal!</h3>
</div>
<input type="text" ng-model="new" /><button ng-click="check()" >check</button>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="ok()">OK</button>
<button class="btn btn-warning" ng-click="cancel()">Cancel</button>
</div>
</script>
</div>
</body>
</html>
당신을 감사하고있다
여기에 고정 plunkr
호출 검사(), 새 변수로 전달의 ... –
문제가 해결되면 대답을 수락하십시오. 이 방법은 다음과 같습니다. http://meta.stackexchange.com/a/5235 @BharathKumar –