I have downgraded many Angular[Ng2] based components and used them in AngularJS application, so ideally a statement like below works perfectly -
angular.module('com.myservicemodule').service("overviewService", upgradeAdapter.downgradeNg2Provider(OverviewComponent));
Here OverviewComponent is a Angular[NG2] component and i have downgraded it and added to my AngularJS module "com.myservicemodule".So final AngularJs bootstraped application do run time execution like below for these dependencies-
var myApp = angular.module('myApp',['com.myservicemodule']) .run('$rootScope', '$q','$window','$location','OverviewComponent', function($q, $window,$location,OverviewComponent){// Some app code});
But now i have an hybrid app which bootstrap with x number of dependencies and some of these dependencies are a downgraded version of Angular[NG2] component.
And start getting ng2.injector issues as if these components are not downgraded on time for angularjs.
I tried with latest way of using downgrade Angular[Ng2] components like-
import {UpgradeModule} from '@angular/upgrade/static';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
export const upgradeAdapter = platformBrowserDynamic().bootstrapModule(AppModule).then(platformRef => {
return platformRef.injector.get(UpgradeModule);
});
And then downgrade the Angular[NG2] component to a directive like -
downgradeComponent({component: OverviewComponent}) as angular.IDirectiveFactory
but using this it seems i get only directive in angularJs 1.X. So anyone know how to get service,controllers counterparts?