如何獲取name2
的值?如何從輸入框中獲取angularJS中的值
function DemoController($scope) {
$scope.name1 = 'LISA';
//How can I get the value of name2?
console.log($scope.name2) //this does not work
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="" ng-controller="DemoController">
{{ name1 }}
<input type="text" placeholder="Lisa" ng-model="name2">
</div>
謝謝,它幫助我! – 2015-04-02 10:21:41
不客氣。請接受答案 – 2015-04-02 10:51:19