【问题标题】:How to generate a module with a routing module in an Ionic Project如何在 Ionic 项目中生成带有路由模块的模块
【发布时间】:2021-10-18 00:35:22
【问题描述】:

我有一个新的 Ionic 项目,正在尝试使用其路由模块创建一个新的功能文件夹。我尝试了文档提供的命令:

ng generate module customers --route customers --module app.module 

在一个 Ionic 项目上,我有这个错误:

File customers/customers.module.ts does not exist.

我无法弄清楚这是什么问题。也许是离子架构中的 smtg?

谢谢。

【问题讨论】:

  • 只要加上--routing true参数?

标签: angular ionic-framework routes command-line-interface


【解决方案1】:

你应该使用:

ng generate module xxx --routing

顺便说一句,您可以尝试帮助查看选项:

options:
  --flat
    Create the new files at the top level of the current project root.
  --lint-fix
    Apply lint fixes after generating the module.
  --module (-m)
    The declaring NgModule.
  --project
    The name of the project.
  --route
    The route path for a lazy-loaded module. When supplied, creates a component in the new module, and adds the route to that component in the `Routes` array declared in the module provided in the `--module` option.
  --routing
    Create a routing module.
  --routing-scope
    The scope for the new routing module.

【讨论】:

    猜你喜欢
    • 2017-07-19
    • 2020-03-04
    • 1970-01-01
    • 1970-01-01
    • 2016-01-02
    • 1970-01-01
    • 2019-09-11
    • 1970-01-01
    • 2020-10-07
    相关资源
    最近更新 更多