繁体   English   中英

我当前的项目是使用 Angularjs 构建的,我想在同一个现有项目中的 angular 7 中添加新内容。 我怎样才能做到这一点

[英]My current project is build using Angularjs and i want to add new things in angular 7 in the same existing project. How can i do that

我正在开发一个使用AngularJS构建的项目,我想使用Angular 7在同一个项目中添加新内容。 因此,无论在项目中添加什么新模块,都应该使用Angular 7构建它。 我怎样才能做到这一点? 请帮我。

这可以通过ngUpgrade模块完成,它允许您降级 Angular 组件、服务并在 AngularJS 中使用它。 遵循官方指南。

以下是如何降级 Angular 组件的示例:

import { downgradeComponent } from '@angular/upgrade/static';

angular.module('heroApp', [])
  .directive(
    'heroDetail',
    downgradeComponent({ component: HeroDetailComponent }) as angular.IDirectiveFactory
  );

现在您可以在现有的 AngularJS 项目中使用heroDetail

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM