(Reason: CORS request did not succeed)

#1

import { Component } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;

//importing woocommerce api for product showing, WC is a local variable
import * as WC from “woocommerce-api”;

@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class Home {
// creating a loacl object, type any
WooCommerce: any;

constructor(public navCtrl: NavController) {
// in constructor initialize the woocommerce api as WC. we set properties in it.
this.WooCommerce = WC({
url: “http://localhost/my_site/”,
consumerKey: “key”,
consumerSecret: “key”
});

//get data from woocommerce store
this.WooCommerce.getAsync("products").then( (data) => {
  console.log(JSON.parse(data.body));
}, (err) => {
  console.log(err);
})

}

}

the error is,
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost/wordpress/wc-api/v3/products?oauth_consumer_key=key&oauth_nonce=aaa&oauth_signature_method=HMAC-aa&oauth_timestamp=aa&oauth_version=1.0&oauth_signature=aa%3D. (Reason: CORS request did not succeed).