0

I want to save typeP into typePackage I have my function :

typePackage :any =[];
getTypeUnity(){
   this.typePackage=this.api.consultasByID({
      cquery:10001,
      campo:'ctipopaquete;descripcion',
      parametros:''
    },function(success,datos){
        if(success){
          let type : any={ctipopaquete:Number,descripcion:String};
          let typeP : any=[];
          for(let k in datos.DAT){
            type.ctipopaquete = datos.DAT[k].ctipopaquete;
            type.descripcion = datos.DAT[k].descripcion;
            typeP.push(type)
            type = {ctipopaquete:Number,descripcion:String};
          } 
             this.typePackage = typeP; // error undefined
        }else console.log("error")
      }); 

}

When set "typePackage", it is undefined. You can help me as I set the typeP variable in typePackage

0 Answers0