私はidをapiに送信します。私はオブジェクトで応答を得て、itemprice配列で構成されています。 object.itemprice.lengthは未定義です。そしてitempriceの対象JSONレスポンスarray.lengthのオブジェクトは、anglejsで定義されていません
Resource {$promise: Promise, $resolved: false}
$promise:Promise
$resolved:true
__v:3
_id:"573f087078e73e28186a2fb7"
createdAt:"2016-05-20T12:52:00.897Z"
defaultmainprice:180
defaultofferprice:160
isDeleted:false
itemcode:"1000"
itemdescription:"Sun flower 1lit"
itemname:"Sun flower 1lit"
itemprice:Array[2]
modifiedAt:"2016-05-20T12:52:00.898Z"
status:false
subcatid:"5736aea0d3f55f3c155999a8"
unit:"1 lit"
$scope.itemslist.itemprice.length
が未定義
ある
//Controller:
ZustShopController.controller("ProductController",function($rootScope,$scope,DecreaseQuantitytService){
$scope.itemslist=DecreaseQuantitytService.DecreseQuantiyItem(item)
})
//Service:
ZustShopService.service("DecreaseQuantitytService",function(DecreaseQuantitytFactory){
this.DecreseQuantiyItem=function(item){
return DecreaseQuantitytFactory.DecreseAllQuantiyItem(item)
}
});
//Factory:
ZustShopFactory.factory("DecreaseQuantitytFactory",function($resource,RES_URL){
var iteminfo;
var itemresource=$resource(RES_URL+"product/:id/:itemcode",{"itemcode":"@itemcode"},{update:{method:"PUT"}})
return{
DecreseAllQuantiyItem:function(item){
iteminfo=itemresource.get({"itemcode": item.itemcode,"id":item.prevsubid});
return iteminfo;
}
})
未定義この
あなたは '$ scope.itemslist.itemprice.length'を使用しようとしているコードを共有してください。 – seekers01