Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
并排运行AngularJS和AngularJS框架_Angularjs_Angular_Ng Upgrade_Angular Hybrid - Fatal编程技术网

并排运行AngularJS和AngularJS框架

并排运行AngularJS和AngularJS框架,angularjs,angular,ng-upgrade,angular-hybrid,Angularjs,Angular,Ng Upgrade,Angular Hybrid,我找到了描述如何将AngularJS(2)组件集成到AngularJS中的资源,但所有这些都涉及到像AngularJS项目一样设置AngularJS项目,需要TypeScript的transpiler,需要ES6,需要导入语句。我只想在AngularJS应用程序中使用角度组件,而不会中断现有的工作流。这可能吗?如果可能,我该如何实现?我以为这就是升级模块的目的,但是我看到的所有教程都需要AngularJS应用程序中的导入语句,这需要一个transpiler。如果AngularJS应用程序需要提前

我找到了描述如何将AngularJS(2)组件集成到AngularJS中的资源,但所有这些都涉及到像AngularJS项目一样设置AngularJS项目,需要TypeScript的transpiler,需要ES6,需要导入语句。我只想在AngularJS应用程序中使用角度组件,而不会中断现有的工作流。这可能吗?如果可能,我该如何实现?我以为这就是升级模块的目的,但是我看到的所有教程都需要AngularJS应用程序中的导入语句,这需要一个transpiler。如果AngularJS应用程序需要提前传输,这是可以的,但是AngularJS应用程序无法传输,因为它正在django服务器上运行,我不想运行另一台带有传输程序的服务器

明确地说,我当前的AngularJS应用程序由django提供服务。我想包括一些角度分量。这些文件在开发过程中不会被触及,因此可以在不影响工作流的情况下提前传输。有没有一种方法可以将这些组件添加到AngularJS应用程序中,而无需向AngularJS应用程序添加transpiler

以增量方式将AngularJS应用程序升级为AngularJS。 成功升级的关键之一是增量升级,方法是在同一应用程序中并排运行两个框架,并将AngularJS组件逐个移植到AngularJS。这使得在不中断其他业务的情况下升级大型和复杂的应用程序成为可能,因为这些工作可以协同完成并在一段时间内分散。Angular中的
升级
模块旨在实现无缝增量升级

有关详细信息,请参阅

另见


我不想用transpiler运行另一台服务器

transpiler可以在客户端运行。这是可能的,但不推荐

<script src="https://unpkg.com/zone.js@0.8.4?main=browser"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
  System.import('main.js').catch(function(err){ console.error(err); });
</script>

有关详细信息,请参阅


将Angular TypeScript示例转换为ES6和ES5 JavaScript。 在TypeScript中使用Angular可以做的任何事情,都可以在JavaScript中完成。从一种语言到另一种语言的转换主要是改变组织代码和访问API的方式


有关更多信息,请参见

仅为清楚起见。。。transpiler在部署到服务器之前在客户端上运行。所以不需要在你的服务器上设置任何特殊的设置。这很好,但我还不能在本地运行。它似乎是专门为示例而设置的,不建议用于实际应用程序。那么,我所要求的似乎是不可能的。也许我的问题不清楚:我想提前传输Angular2组件,然后在我的AngularJS应用程序中将它们用作AngularJS指令,而不包括像webpack和transpilers这样的Angular2导入。我将更新我的问题。将TS的附加信息添加到JS。谢谢,但代码已经用TS编写。我想答案是否定的:(
/**
 * WEB ANGULAR VERSION
 * (based on systemjs.config.js in angular.io)
 * System configuration for Angular samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
  System.config({
    // DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
    transpiler: 'ts',
    typescriptOptions: {
      // Copy of compiler options in standard tsconfig.json
      "target": "es5",
      "module": "commonjs",
      "moduleResolution": "node",
      "sourceMap": true,
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "lib": ["es2015", "dom"],
      "noImplicitAny": true,
      "suppressImplicitAnyIndexErrors": true
    },
    meta: {
      'typescript': {
        "exports": "ts"
      }
    },
    paths: {
      // paths serve as alias
      'npm:': 'https://unpkg.com/'
    },
    // map tells the System loader where to look for things
    map: {
      // our app is within the app folder
      'app': 'app',

      // angular bundles
      '@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
      '@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
      '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
      '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
      '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
      '@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
      '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
      '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
      '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
      '@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js',
      '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
      '@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
      '@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',

      // other libraries
      'rxjs':                      'npm:rxjs@5.0.1',
      'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
      'ts':                        'npm:plugin-typescript@5.2.7/lib/plugin.js',
      'typescript':                'npm:typescript@2.2.1/lib/typescript.js',

    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      app: {
        main: './main.ts',
        defaultExtension: 'ts',
        meta: {
          './*.ts': {
            loader: 'systemjs-angular-loader.js'
          }
        }
      },
      rxjs: {
        defaultExtension: 'js'
      }
    }
  });

})(this);