gpt4 book ai didi

javascript - Angular 2 MBAAS

转载 作者:太空狗 更新时间:2023-10-29 17:55:21 24 4
gpt4 key购买 nike

几天来,我一直在努力寻找适用于 Angular 2(我使用的是 Ionic 2)的 MBAAS。 Parse 正在关闭,所以这对我和我尝试过的其他人(Firebase、Backendless 等)来说并不是一个真正的选择。似乎还没有 Angular 2 SDK。

这可能是我不耐烦,但我真的很想现在就开始使用它,但没有像样的 SDK 我做不到。

是的,如果我真的想要的话,我也可以使用 REST API,但我觉得这会限制应用所需的简单推送通知等功能。

所以问题是:有谁知道支持 Angular 2 并且有一个库可用于支持推送通知和数据存储的 MBAAS?

编辑:

例如,尝试在 Angular 2 中使用后端 mbaas,我尝试了以下方法:

结构:

 - app
- app.js
- backendless.js
-- pages
--- home
---- home.html
---- home.js
---- home.scss
-- theme

应用程序.js

import {App, Platform} from 'ionic-angular';
import {HomePage} from './pages/home/home';
import {Backendless} from 'backendless';

@App({
template: '<ion-nav [root]="rootPage"></ion-nav>',
config: {} // http://ionicframework.com/docs/v2/api/config/Config/
})
export class NotOnFileApp {
static get parameters() {
return [[Platform]];
}

constructor(platform) {
this.rootPage = HomePage;

platform.ready().then(() => {
// The platform is now ready. Note: if this callback fails to fire, follow
// the Troubleshooting guide for a number of possible solutions:
//
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
//
// First, let's hide the keyboard accessory bar (only works natively) since
// that's a better default:
//
// Keyboard.setAccessoryBarVisible(false);
//
// For example, we might change the StatusBar color. This one below is
// good for dark backgrounds and light text:
// StatusBar.setStyle(StatusBar.LIGHT_CONTENT)

Backendless.initApp( 'XXXXX', 'XXXXX', 'v1' );

});
}
}

这给出了错误:“无法读取未定义的属性‘initApp’”,这表明我没有正确导入 js 库。你能帮忙解释一下为什么会这样吗?

最佳答案

因此,经过多次更改、删除、添加和谷歌搜索后,我找到了一种有效的方法。下面是方法。如果这不是执行此操作的正确方法或有更好的方法,请告诉我。

在使用backendless的例子中,先通过npm安装:

npm install backendless

现在在 app.js 的顶部添加:

import 'backendless';

现在您可以轻松地在该文件中使用它。例如。

Backendless.initApp( 'XXXXX', 'XXXXX', 'v1' );

我猜你必须将它导入到你想使用的每个页面,但不确定是哪个页面。

关于javascript - Angular 2 MBAAS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35827073/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com