如何使用angularjs动态获取文本框值 [英] how to get text box values dynamically using angularjs

查看:879
本文介绍了如何使用angularjs动态获取文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  <div class="form-group" ng-repeat="x in propertynames" ng-init="items">
  <label class="control-label col-lg-2">{{x.name}} :        </label>
  <div class="col-lg-4">
  <input type="text" name="{{x.name}}" class="form-control" required=""ng-model='a'>
  </div>
{{a}}  </div>
<input type="button" on-click="entrybtn()" value="Save" class="btn btn-success form-control">







$scope.propertynames=[];
$http(
{
  method:'GET',
  url:'dataentry'
  headers: 
  {
  'Content-Type': 'application/x-www-form-urlencoded'
  }
  }).success(function(data)
 {
 $scope.propertynames=data;
 });
$scope.entrybtn=function()
{
}

推荐答案

scope.propertynames = [];
scope.propertynames=[];


http(
{
method:' GET'
url:' dataentry'
标题:
{
' Content-Type'' application / x-www-form-urlencoded'
}
})。success( function (data)
{
http( { method:'GET', url:'dataentry' headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).success(function(data) {


scope.propertynames =数据;
});
scope.propertynames=data; });


这篇关于如何使用angularjs动态获取文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆