mean-expert-official / loopback-sdk-builder

Tool for auto-generating Software Development Kits (SDKs) for LoopBack
Other
399 stars 175 forks source link

Support for Angular Modules (>= RC5) #86

Closed l0stpenguin closed 8 years ago

l0stpenguin commented 8 years ago

I tried integrating your sdk into a Rc.5 project forked from: angular2-starter

I added the _APIPROVIDERS to the app module and tried injecting the EboardUserApi in the navbar.module

The EboardUserApi is subclass of UserApi, when i launch the app, I get the following error:

(index):45 Error: (SystemJS) Cannot read property 'prototype' of undefined
    TypeError: Cannot read property 'prototype' of undefined
        at __extends (http://localhost:3000/src/tmp/app/shared/sdk_back/services/custom/User.js:5:68)
        at eval (http://localhost:3000/src/tmp/app/shared/sdk_back/services/custom/User.js:33:5)
        at Object.eval (http://localhost:3000/src/tmp/app/shared/sdk_back/services/custom/User.js:883:2)
        at eval (http://localhost:3000/src/tmp/app/shared/sdk_back/services/custom/User.js:888:4)
        at eval (http://localhost:3000/src/tmp/app/shared/sdk_back/services/custom/User.js:889:3)
    Evaluating http://localhost:3000/src/tmp/app/shared/sdk_back/services/custom/User.js
    Evaluating http://localhost:3000/src/tmp/app/shared/sdk_back/services/custom/index.js
    Evaluating http://localhost:3000/src/tmp/app/shared/sdk_back/services/index.js
    Evaluating http://localhost:3000/src/tmp/app/shared/sdk_back/index.js
    Evaluating http://localhost:3000/src/tmp/app/shared/sdk_back/services/core/logger.service.js
    Evaluating http://localhost:3000/src/tmp/app/shared/sdk_back/services/core/index.js
    Evaluating http://localhost:3000/src/tmp/app/shared/sdk_back/services/custom/EboardUser.js

It seems when the UserApi is trying to inherit from BaseLoopBackApi but the latter is undefined. Below is a sample project to replicate this issue: https://github.com/mevinDhun/angular2-rc5-loopback

Is there a step i am missing? I checked your docs but they have not been update for Rc5.

jonathan-casarrubias commented 8 years ago

@mevinDhun thanks for reporting, I've been having a really hard time with RC, was able to make it work until creating the NgModule thing, which breaks everything in my projects.

I will start a project from scratch in RC5 and WebPack and verify which changes needs to be done, but certainly this RC5 broke more than the expected.

Cheers, Jon

chl03ks commented 8 years ago

¿Are you working in this ?, maybe i can help you.

jonathan-casarrubias commented 8 years ago

@gvsdan Right now I'm finishing the latests bugs that today I will be publishing under the version RC9.

After that my top priority will be to migrate to RC5 and if there is no other bug in the road I may be launching the stable version during this week.

I think the most painful part will be to update the unit tests to RC 5, but I'm estimating that turing the SDK into a NgModule should not be a big deal.

chl03ks commented 8 years ago

@jonathan-casarrubias Thanks for the update.

l0stpenguin commented 8 years ago

Actually i had a working project using angular rc4 and sdk builder v2.0.0-beta19. I tried upgrading to angular rc5 and the latest version of the sdk builder and got several errors. I am also having a hard time with the breaking changes of NgModules and still trying to understand them. So it may be possible that the above project i linked has errors not because of the sdk builder but because of other related codes. Right now, i'll be sticking to the Rc4 version.

jonathan-casarrubias commented 8 years ago

@gvsdan no problem is great to see more people involved in this project, stay around.

@mevinDhun all the SDK RC Versions should work with Angular RC4 with no problem, so I recommend to stick to RC4 for some days until everything is migrated to RC5.

Fortunately -if we may believe it- the folks from Angular2 says that no more api changes will be done after this, so once I upgrade the generated SDK to NgModule and update the unit tests to Angular 2 RC 5 I may be publishing the version 2.0.0 stable with NgModules support.

Cheers!! Jon

jonathan-casarrubias commented 8 years ago

This feature has been implemented and will be released under version 2.0.0-stable

chl03ks commented 8 years ago

@jonathan-casarrubias Thanks

jonathan-casarrubias commented 8 years ago

Please read the new documentation in order to setup the SDK.

Cheers! Jon