@MalavShah wrote:
Thanks in advance
------------------------------------Code is as below-----------------------------------------------------------------------import { Component,NgZone } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;
import { Platform } from “ionic-angular”;//declare var window:any;
declare var ApiAIPromises:any;
//declare const ApiAIPlugin: any;
@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage {
answer:String;
constructor(public navCtrl: NavController,public platform: Platform, public ngZone: NgZone) {
//ai
/*platform.ready().then(() => {
ApiAIPromises.init({
clientAccessToken: “4596e9d3a1b641db86d96a0ae86e165f”
})
.then((result) => console.log(result))});
*/
platform.ready().then(() => {
ApiAIPromises.init({
clientAccessToken: “4596e9d3a1b641db86d96a0ae86e165f”
})
.then((result) => console.log(result))});
//ai
}
ask(question) {
ApiAIPromises.requestText({
query: question
})
.then(({result: {fulfillment: {speech}}}) => {
this.ngZone.run(()=> {
this.answer = speech;
});
})
}}
Posts: 1
Participants: 1