angular / ngMigration-Forum

109 stars 7 forks source link

Custom Ts Services Causing Component Controllers to Not Instantiate #11

Closed weasnerb closed 5 years ago

weasnerb commented 5 years ago

Hello Angular Team,

I am working on migrating and I have been having issues with my angular js component controllers not being instantiated if one of our project's custom angular js services is injected into it. Any ideas why this is happening when they are still working in our production angular js build and have not been changed since?

I thought it may be due to us using ts classes and using $inject to inject other angular js services using the following syntax:

class MyService {
constructor(foo, bar) {
// use needed injected services
}
}
MyService.$inject = ['foo', 'bar'];
angular.module('my.module').service('MyService', MyService);

However I have seen some articles that talk about upgrading their services to angular and they look the same? I guess I am assuming that they already have a hybrid app, but I doubt they would be upgrading their service if they were not.

Thanks in advance!

weasnerb commented 5 years ago

I just rewrote one of our services to angular and downgraded it to angular js and it is working well, while this doesn't tell me what is wrong it does work.

weasnerb commented 5 years ago

I fixed this issue, the services work as expected.

After I upgraded the service mentioned in the previous comment, I started enabling the other services one by one, and I realized that a shared service that almost all of the other services required had an exception being thrown that would bubble up and kill the app without any error messaging.