Angular 2

Is there a library specifically for Angular 2? Trying out the Ionic Framework 2 beta which uses it?

I’m also hoping for it!

I couldn’t find one, but they do supply a REST API. You can use Http from angular2/http to do just about everything (I think…)

import {Http, Headers} from 'angular2/http';

Then, just use the good ol’ StackOverflow for Angular2 Http help (it’s pretty straight forward).

Support for Angular 2 (as well as generic TS library) should be available later this week.

Will an email go out? Or should I just keep checking the site?

It will be in the blog and a newsletter.

any news?

Hi guys,

We just published a Quick Start Guide for Angular 2. Please try it out and let us know what you think:
https://backendless.com/mobile-developers/quick-start-guide-for-angular2

Regards,
Mark

Looks pretty straight forward. I’ll monkey around with it today/tomorrow and let ya know how it goes.

Hi Mark,

thanks for the quick start guide. Unfortunately, it’s throwing an error for me.

app.bundle.js:3209 Uncaught TypeError: Cannot read property 'initApp' of undefined

I’m using Ionic v2 with -obviously- Angular v2.
The import and typings of Backendless’ module works with

import {Backendless} from 'backendless';

I’m initializing the Backendless app with

Backendless.initApp(Config.backendless.appId, Config.backendless.appKey, Config.backendless.appVersion);

This throws an undefined error, because it gets compiled into

backendless_1.Backendless.initApp(config_1.Config.backendless.appId, config_1.Config.backendless.appKey, config_1.Config.backendless.appVersion);

However, the initApp function is defined on the backendless_1 object.

Do you know what to do?
thanks
Martin

Hi Martin,

Please change the import line to look like this:

import Backendless from 'backendless';

The guide has been updated to reflect that change.

Please let me know if it helps.

Regards,
Mark

Hi Mark,

thanks for the reply.
This does not work, it says “Module ‘backendless’ has no default export”.
bests
Martin

Hi Martin,

I’m not expert of Ionic2 but I’ll try to help you,

Looks like the problem with CommonJS and ES6 export/import format

backendless.js (JS-SDK) return Backendless object which has no “default” key,
with SystemJS the problem is not being because SystemJS adds link to export object as “default” key

a little explanation about how “import” compiled:

import Backenldess from 'backendless';
console.log(Backendless);


//compiled to CommonJS module:


var backendless_1 = require('backendless');
console.log(backendless_1.default);
import { Backenldess } from 'backendless';
console.log(Backendless);


//compiled to CommonJS module:


var backendless_1 = require('backendless');
console.log(backendless_1.Backendless);
import * as Backenldess from 'backendless';
console.log(Backendless);


//compiled to CommonJS module:


var backendless_1 = require('backendless');
console.log(backendless_1);

so for now for import Backendless into your TypeScript app which compiled to CommonJS you need write:

import * as Backendless from 'backendless';

please, let me know if it helped you

thanks, Vlad