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

Error:ApiAi is not Defined

$
0
0

@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

Read full topic


Viewing all articles
Browse latest Browse all 70754

Trending Articles



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