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>
謝謝你這是工作... – 2014-09-24 06:39:28
如果解決了您的問題,請接受答案。這是你如何做到這一點:http://meta.stackexchange.com/a/5235 @BharathKumar – 2014-09-24 07:20:25