angularjs 从递归模板中的输入获取值
angularjs get value from input in recursive template
如何从嵌套视图中获取控制器的值?我想提一下我有一个递归方法。
HTML
<textarea ng-model="inputValue" class="ng-valid ng-dirty ng-valid-parse ng-touched"></textarea>
Full HTML structure can be found here
编辑:
我想在我的控制器中获取文本区域的值。 (例如 $scope.inputValue );当前未定义
查看这个 jszfiddle
http://jsfiddle.net/7qbucc62/
<div ng-app="app">
<div ng-controller="firstController">
<textarea ng-model="inputValue"></textarea>
<textarea ng-model="inputValue"></textarea>
</div>
</div>
<script>
(function abc()
{
var app=angular.module("app",[]);
app.controller("firstController",function($scope)
{
$scope.inputValue="";
});
})();
</script>
我想这就是你要问的
您可以直接在您的控制器中使用 $scope.inputValue。它将为您提供 textarea
的值
如何从嵌套视图中获取控制器的值?我想提一下我有一个递归方法。
HTML
<textarea ng-model="inputValue" class="ng-valid ng-dirty ng-valid-parse ng-touched"></textarea>
Full HTML structure can be found here
编辑: 我想在我的控制器中获取文本区域的值。 (例如 $scope.inputValue );当前未定义
查看这个 jszfiddle http://jsfiddle.net/7qbucc62/
<div ng-app="app">
<div ng-controller="firstController">
<textarea ng-model="inputValue"></textarea>
<textarea ng-model="inputValue"></textarea>
</div>
</div>
<script>
(function abc()
{
var app=angular.module("app",[]);
app.controller("firstController",function($scope)
{
$scope.inputValue="";
});
})();
</script>
我想这就是你要问的
您可以直接在您的控制器中使用 $scope.inputValue。它将为您提供 textarea
的值