Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.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
Node.js 如何将节点导入语句添加到带有角度示意图的文件中?_Node.js_Angular_Angular Schematics - Fatal编程技术网

Node.js 如何将节点导入语句添加到带有角度示意图的文件中?

Node.js 如何将节点导入语句添加到带有角度示意图的文件中?,node.js,angular,angular-schematics,Node.js,Angular,Angular Schematics,我想要一个自定义的原理图,它将在我的应用程序中创建一个页面。为此,我想使用现有的核心原理图创建一个路由模块,然后在该模块中创建一个组件来显示我的页面内容,最后将所有内容连接在一起。让我感到困惑的是“把所有东西连接起来”。我找不到关于“正确”方法的明确指导。我应该: a) 直接修改“模块”和“部件”示意图创建的现有文件?(我不知道怎么做) b) 使用模板以某种方式将修改合并到文件中?(我也不知道怎么做) 下面是到目前为止我的页面示意图的index.ts文件。我不知道怎么做的是在结尾处用“TODO”

我想要一个自定义的原理图,它将在我的应用程序中创建一个页面。为此,我想使用现有的核心原理图创建一个路由模块,然后在该模块中创建一个组件来显示我的页面内容,最后将所有内容连接在一起。让我感到困惑的是“把所有东西连接起来”。我找不到关于“正确”方法的明确指导。我应该:

a) 直接修改“模块”和“部件”示意图创建的现有文件?(我不知道怎么做)

b) 使用模板以某种方式将修改合并到文件中?(我也不知道怎么做)

下面是到目前为止我的页面示意图的index.ts文件。我不知道怎么做的是在结尾处用“TODO”来评论

请帮忙

import {
  externalSchematic,
  Rule,
  SchematicContext,
  Tree,
  chain,
} from '@angular-devkit/schematics';

export function page(options: any): Rule {
  const name = options.name;

  return chain([
    // create module for this page
    externalSchematic('@schematics/angular', 'module', {
      name: `pages/${name}`,
      routing: true
    }),

    // create simple component to display in this page
    externalSchematic('@schematics/angular', 'component', {
      name: `pages/${name}/${name}`,
      routing: true
    }),

    // add component to routing module
    (tree: Tree, _context: SchematicContext) => {
      // TODO 1: import new component into routing module
      // e.g. import { MyPageComponent } from "./my-page/my-page.component";

      // TODO 2: add component to routes
      // const routes: Routes = [{ path: '', pathMatch: 'full', component: MyPageComponent }];
      return tree;
    },
  ]);
}


你有没有找到答案或者找到答案?我需要使用Angular 7 schematics将导入语句添加到现有的typescript文件中。。。