Downgrade NG2 Directive to AngularJS

狂风中的少年 提交于 2019-12-08 04:07:26

问题


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.



来源:https://stackoverflow.com/questions/42855446/downgrade-ng2-directive-to-angularjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!