简体   繁体   English

无法构建与Angular 4集成的Angular JS应用程序

[英]Not able to build Angular JS application integrate with Angular 4

I have a Angular JS application where each angular JS library files are included in html file for each functionality.Is it feasible to make this application work together with Angular 4. 我有一个Angular JS应用程序,其中每个Angular JS库文件都包含在html文件中以实现每种功能。使该应用程序与Angular 4一起工作是否可行。

Steps to make Angular JS work with Angular 4 使Angular JS与Angular 4兼容的步骤

1)install the @angular/upgrade How do I do make this work in sync with the old Angular JS files 1)安装@ angular / upgrade我该如何使其与旧的Angular JS文件同步

2)I read it in a post that I need to define this in system.config.js 2)我在需要在system.config.js中定义的帖子中阅读了它

System.config({
  map: {
    '@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js'
  }
});

3)In app.module.ts 3)在app.module.ts中

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { UpgradeModule } from '@angular/upgrade/static';

@NgModule({
  imports: [
    BrowserModule,
    UpgradeModule
  ],
  bootstrap: []
})
export class AppModule {
  ngDoBootstrap() {}
}

4)main.ts 4)main.ts

import { NgModule } from '@angular/core';
import { UpgradeModule } from '@angular/upgrade/static';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

platformBrowserDynamic().bootstrapModule(AppModule).then(platformRef => {
  const upgrade = platformRef.injector.get(UpgradeModule) as UpgradeModule;
  upgrade.bootstrap(document.body, ['myApp'], { strictDi: true });
});

Are these steps sufficient to integrate Angular JS application to Angular 4.If so how do I do a build.The existing process is a monolithic application with Maven Build?Can Angular 4 be integrated with Maven? 这些步骤是否足以将Angular JS应用程序集成到Angular 4中?如果是的话,我该如何进行构建?现有的过程是带有Maven Build的整体应用程序吗?

The official Angular website has a migration guide here Angular官方网站在此处提供了迁移指南

The old versions of Angular (AngularJS 1.x) have a completely different project structure to the new Angular >2. Angular的旧版本(AngularJS 1.x)与新的Angular> 2具有完全不同的项目结构。 This guide should help you out. 本指南应为您提供帮助。

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

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