-->

Downgrade NG2 Directive to AngularJS

2019-06-08 05:38发布

问题:

So as far as I know we can downgrade NG2 Components & Services into AngularJS. But I'm wondering if it's possible to do that for NG2 Directives?

I read the upgrade/downgrade guides already but I couldn't find anything. I found the way to upgrade AngularJS Directives but not the other way around!

Something like this but for directive (This is for components):

angular.module('heroApp', [])
  .controller('MainController', MainController)
  .directive('heroDetail', downgradeComponent({
    component: HeroDetailComponent,
    inputs: ['hero'],
    outputs: ['deleted']
  }) as angular.IDirectiveFactory);

Any help?

回答1:

So apparently we don't need to downgrade a NG2 Directive. Just add it as a declaration into your application and it will work.