Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

How to send and get the result from Api in ionic 4

$
0
0

@ice174 wrote:

I am new in ionic 4, I want to send the barcode result to the api then get the api response result from the api. How to do it?
Here is my code home.page.ts:

export class HomePage {
result: any;

  constructor(
    private barcodeScanner: BarcodeScanner,
    private http: HttpClient
  ) {}

onScan() {
        this.barcodeScanner.scan().then(barcodeData => {
         return this.http.post('https://xxx/xxx/xxx', barcodeData).subscribe(data => {
              this.result= data;
            });
          });

here is my home.html

<ion-content>
    <ion-button (click)="onScan()">Scan</ion-button>
    <ion-label>{{result}}</ion-label>
</ion-content>

From this code no result show. Anyone can help me?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>