将NG2指令降级为AngularJS [英] Downgrade NG2 Directive to AngularJS

查看:57
本文介绍了将NG2指令降级为AngularJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,我们可以降级NG2组件&服务进入AngularJS。
但是我想知道是否可以为NG2指令做到这一点?

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?

我已经阅读了升级/降级指南但我找不到任何东西。
我找到了升级AngularJS指令的方法,但没有相反的方法!

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);

任何帮助?

推荐答案

所以显然我们不需要降级NG2指令。只需将其作为声明添加到您的应用程序中即可。

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

这篇关于将NG2指令降级为AngularJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆