我想将我的Ionic2应用程序设置为使用Backand SDK。我是Ionic2/Angular2的新手,在Ionic2应用程序中找不到任何示例。我只能找到Ionic1/Angular1应用程序的示例应用程序,这些应用程序对我没有帮助。
有线索吗?
谢谢,Guillaume
正如Aaron所说,您可以从存储库中的/app/service文件夹中获取"backandService.ts"文件
https://github.com/backand/ionic2-crud-example
这里有文件的直接链接。
如果你使用的是Typescript,你将能够用以下代码段加载它:
import {BackandService} from '../../services/backandService'
在构造函数中注入BackandService:
constructor(public backandService:BackandService) {
}
并且这样登录:
this.backandService.getAuthTokenSimple(this.username, this.password);
然后用这个代码发布数据:
this.backandService.postItem(this.name)