html:

<div ng-repeat="addr in addrShipData">
     <input type="radio" name="resp1" ng-checked='true'/>
      {{addr.addressLine1 +","+addr.addressLine2+", "+addr.city+ ","+addr.state+", "+addr.country+", "+addr.zipCode+","+addr.contactNum}}
 &nbsp;&nbsp;&nbsp;&nbsp; <a>Edit</a>
</div>

js code:

 var dataObj = [];
  var shipDataObj = [];
  //var addrShipData =[];
  function shipData(shipDataObj){

      for(i=0;i<shipDataObj.length;i++){
          dataObj.push(addressLine1 = shipDataObj[i].addressLine1);
          dataObj.push(addressLine2 = shipDataObj[i].addressLine2);
          dataObj.push(city = shipDataObj[i].city);
          dataObj.push(state = shipDataObj[i].state);
          dataObj.push(country = shipDataObj[i].country);
          dataObj.push(zip = shipDataObj[i].zipCode);
          dataObj.push(contactNum = shipDataObj[i].contactNumber);
      }
  }
   appServices.getAddress(userData.customerId).then(function (data){

                    if (data){  
                          console.log(data);
                          $scope.shipDataObj = data;
                          shipData(data);
                        console.log("dataObj properties: " + dataObj);
                        $scope.addrShipData = dataObj;
                        console.log($scope.addrShipData);
                     if ($scope.addrShipData){
                                storeLocally.set('shipInfo :', $scope.addrShipData);
                          }
                          else{
                                $scope.addressError = "No Address Found!";                            
                          }         
                    console.log("address info:- " + $scope.addrShipData);
                    }
               }),
                function (data) {
                    if (data.status == 500) {
                      $scope.addressError = "Oops! No Address Found!";
                    };
                }       

In js file I debug the code I am getting all values in $scope.addrShipdata in HTML view I am not getting any value.

在js文件中我调试代码我在HTML视图中获取$ scope.addrShipdata中的所有值我没有得到任何值。

i am getting o/p like this

我得到这样的o / p

on console: 1234 waller ave,suite1,fremont,California,USA,246326,213-435-4365

在控制台上:1234 waller ave,suite1,fremont,California,USA,246326,213-435-4365

on html view: it is displaying blank. O ,, , , , , Edit O ,, , , , , Edit O ,, , , , , Edit O ,, , , , , Edit O ,, , , , , Edit O ,, , , , , Edit O ,, , , , , Edit

在html视图上:它显示为空白。 O ,,,,,编​​辑O ,,,,,编​​辑O ,,,,,编​​辑O ,,,,,编​​辑O ,,,,,编​​辑O ,,,,,编​​辑O, ,,,,,编​​辑

I am not getting any error either.I don't understand where is problem in code.

我也没有收到任何错误。我不明白代码中的问题在哪里。

1 个解决方案

#1


0

You haven't created correct object definition which you are expecting in ng-repeat tempalte. Also you should create a whole object and push it to dataObj which will basically add object with new properties.

您还没有在ng-repeat tempalte中创建正确的对象定义。此外,您应该创建一个完整的对象并将其推送到dataObj,这将基本上添加具有新属性的对象。

Code

for (i = 0; i < shipDataObj.length; i++) {
    dataObj.push({
        addressLine1: shipDataObj[i].addressLine1,
        addressLine2: shipDataObj[i].addressLine2,
        city: shipDataObj[i].city,
        state: shipDataObj[i].state,
        country: shipDataObj[i].country,
        zip: shipDataObj[i].zipCode,
        contactNum: shipDataObj[i].contactNumber
    });
}

更多相关文章

  1. 如何将对象作为参数传播给函数?
  2. RangeError:在Node.js中调试/记录/检查对象时超过了最大调用堆栈
  3. 是否有一个简单的库将JSON对象渲染为树?
  4. 在JavaScript中进行文件处理,第四部分:对象URLs
  5. 我在显示随机选择的对象时遇到问题
  6. 如何在JavaScript / jQuery中获取对象的属性?
  7. 【JavaScript】JavaScript的对象-对象专门语句
  8. 令人惊奇的JavaScript面向对象(一)
  9. JavaScript面向对象程序设计三——原型模式(上)

随机推荐

  1. Html5 舞动的雨伞
  2. iframe调用后台方法通过response返回html
  3. HTML5之MSE标准为移动端的直播应用带来超
  4. 手机端阻止页面滑动
  5. js去除字符串中所有html标签及&nbsp符号
  6. HTML5中window.postMessage,在两个页面之
  7. 如何集中无序列表?
  8. 如何使用一个锚标记打开多个链接
  9. 我正在尝试使用带有post方法的AJAX将用户
  10. 如何只用HTML和CSS构建一个特殊的多边形(