<input type="text" placeholder="0" ng-model="deposit" value="4" />€
alert('begin test');
alert($scope.deposit);
alert('end test');
Run Code Online (Sandbox Code Playgroud)
在将输入值绑定到范围变量时,我做错了什么?
您必须访问$scope控制器中的.查看你的小提琴修改http://jsfiddle.net/lpiepiora/ntszE/2/
基本上你必须定义一个控制器
function MyCtrl($scope) {
$scope.deposit = 4;
$scope.showValue = function() {
alert($scope.deposit);
};
};
Run Code Online (Sandbox Code Playgroud)
然后使用ng-controller指令绑定它:ng-controller="MyCtrl".
| 归档时间: |
|
| 查看次数: |
18201 次 |
| 最近记录: |