Angular and Backendless 5

hi there,
I am trying to use backendless 5 with angular. I have been using for a long time backendless 3, on iOS, Android and also Angular. For a new project, I setup an app with Backendless 5, which works correctly with the iOS and Android APIs. Now I need to develop a web client, so I tried to start from my previous project, and upgrade backendless from package.json

In theory, it seems really simple, I have replaced “backendless”: “^3.1.18”, with “backendless”: “^5.8.12”, and then I noticed that import * as Backendless from ‘backendless’; would not work anymore, so I replaced it with import Backendless from ‘backendless’;

Then I also replaced Backendless.initApp(environment.backendless.APP_ID,
environment.backendless.APP_KEY, “v1”); with Backendless.initApp(environment.backendless.APP_ID,
environment.backendless.APP_KEY); since there is no version anymore.

However, while this compiles, I always get " Cannot read property ‘initApp’ of undefined" when I launch the web app (on the google developer console):

Out of desperation I also tried to the template that I can download from backendless console, I thought that it could give me a super simple starting point or show me what’s different with respect to my more complex project, but this one does not even compile. After running npm install I get all sort of errors:

I would rather resolve the first issue (the undefined one), as that project includes already a lot of components I need, but if you can get the template to work, it would already be something.

Thank you for your help

Hi @Alessandra_Saviotti,

I am not too familiar with Angular, but am trying to help. Please see this article here:

Perhaps it has the details which will help.

Regards,
Mark

thanks Mark, I have just followed that example to see if it made a difference, however I get the same result that I get when I try to upgrade my current project:

This is basically an empty project just created with Angular CLI + adding backendless using npm, so I really do not know how I can move forward.

Is any of your engineers able to look into this? I can even share the project, it’s just the angular template generated according to your guide

Thanks

@vladimir-upirov, could you please help here?

hi all, it seems to work if I use
import ‘backendless’;

instead of
import Backendless from ‘backendless’;

1 Like

Hello @Alessandra_Saviotti

I just added an example for Angular v9 https://github.com/Valodya/JS-SDK-samples/tree/master/angular-9

where the JS-SDK is imported as

import Backendless from ‘backendless’

Regards, Vlad