In the getting started on Wakanda it explain how I can bind my data in my web app via AngularJs.
http://wakanda.github.io/get-started/bind-data-in-webapp.html
The mobile app work with Ionic 2, and I want to know, how I can bind the data like the web app ?
My goal is to have the same result as the getting started but on the mobile side. Anyone can help me ?
You can achieve the same result in Ionic 2 project by using the wakanda.service. all you have to do is :
In home.ts for example
import { Wakanda } from '../../app/wakanda.service';
Add Wakanda to providers array
@Component({
selector: 'page-home',
providers: [Wakanda],
templateUrl: 'home.html'
})
Add Wakanda to the constructor
constructor(public navCtrl: NavController, public wakanda: Wakanda) {}
You can use the service like this :
getHeros() {
this.wakanda.getCatalog().then(ds => {
ds['Superhero'].query({orderBy:"ID desc",pageSize:3}).then(collection => {
this.favoriteSuperheroes = collection.entities;
});
});
}
Display heros in home.html :
<ion-content padding>
<button ion-button (click)= getHeros()>Display Heros</button>
<ion-list>
<ion-item *ngFor="let superhero of favoriteSuperheroes">{{superhero.name}} </ion-item>
</ion-list>
</ion-content>
For more informations about how to interact with Wakanda Server REST API please refer to this link Wakanda JavaScript Client