I’v tried using the ng2woo wrapper for Angular in order to use products from WooCommerce in my Ionic App. This is my App Module page:
import { WooApiModule, WooApiService } from 'ng2woo';
const WooCommerceConfig = {
url: 'https://colorvet.ro/wp-json/wc/v1/products',
consumerKey: 'ck_ebb211a8a50720e50473d48fb40ce9a01fcbcfcd',
consumerSecret: 'cs_eef3bbe757c2a4266fcb0de8c06a002e23dd08ad',
wpAPI: true,
version: 'wc/v1'
};
@NgModule({
declarations: [
MyApp,
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
HttpModule,
WooApiModule.forRoot(WooCommerceConfig),
AngularFireDatabaseModule,
AngularFireModule.initializeApp(firebaseConfig), ],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
],
providers: [
StatusBar,
SplashScreen,
BrowserTab,
Camera,
WooApiService,
DatePicker,
EmailComposer,
{provide: ErrorHandler, useClass: IonicErrorHandler},
]
})
export class AppModule {}
And this is my Ionic page where I try to receive the products:
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, AlertController } from 'ionic-angular';
import { WooApiService } from 'ng2woo';
@IonicPage()
@Component({
selector: 'page-shop',
templateUrl: 'shop.html',
})
export class ShopPage {
produse: any[];
WooCommerce: any;
constructor(public navCtrl: NavController, public navParams: NavParams, private alertCtrl: AlertController,private woo: WooApiService) { }
ionViewDidLoad() {
this.woo.fetchItems('products')
.then(products => console.log(products)
.catch(error => console.log(error));
}
}
When I run the app however, I keep getting the same error:
"No route was found matching the URL and request method"