【发布时间】:2016-05-04 15:41:15
【问题描述】:
我想设置我的 Ionic2 应用以使用 Backand SDK。我是 Ionic2 / Angular2 的新手,我找不到任何带有 Ionic2 应用程序的示例。我只能找到对我没有帮助的带有 Ionic1 / Angular1 应用程序的示例应用程序。
有什么线索吗?
谢谢,纪尧姆
【问题讨论】:
我想设置我的 Ionic2 应用以使用 Backand SDK。我是 Ionic2 / Angular2 的新手,我找不到任何带有 Ionic2 应用程序的示例。我只能找到对我没有帮助的带有 Ionic1 / Angular1 应用程序的示例应用程序。
有什么线索吗?
谢谢,纪尧姆
【问题讨论】:
正如 Aaron 所说,您可以从我的存储库中的 /app/service 文件夹中获取“backandService.ts”文件
https://github.com/backand/ionic2-crud-example
Here你有文件的直接链接。
如果您使用的是 Typescript,则可以使用此 sn-p 加载它:
import {BackandService} from '../../services/backandService'
在你的构造函数中注入 BackandService:
constructor(public backandService:BackandService) {
}
然后像这样登录:
this.backandService.getAuthTokenSimple(this.username, this.password);
然后用这段代码发布数据:
this.backandService.postItem(this.name)
【讨论】: