【发布时间】:2016-06-20 00:28:00
【问题描述】:
几天来,我一直在努力寻找与 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
app.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 库。你能帮忙解释一下为什么会这样吗?
【问题讨论】:
-
不需要特定的 Angular 支持。 Firebase 和其他人与 Angular 配合得很好。如果您遇到特定问题,请创建一个新问题。
-
我似乎无法让这两个工作。您知道 Firebase 使用 Angular 2 或 Ionic 2 的工作示例吗?我用谷歌搜索了一两天,但没有运气。
-
如果你不能让它工作,这甚至可能是 StackOverflow 的一个合适的问题,如果你将代码添加到你的问题中,显示你尝试了什么,你得到的错误消息,当前和预期行为。 stackoverflow.com/help/how-to-ask, stackoverflow.com/help/dont-ask, stackoverflow.com/help/on-topic, meta.stackoverflow.com/questions/260648/…
-
我已更新以包含代码。我认为它需要是专门为 Angular 2 构建的库。因此我没有包含代码。
标签: javascript angular ionic2 mbaas