【问题标题】:How to enter array type value for angular schematics如何为角度示意图输入数组类型值
【发布时间】:2019-08-29 05:57:55
【问题描述】:

我正在学习 Angular Schematics,但在数组类型输入方面遇到了一些问题。

当提示我输入一个值并按 Enter 时,该值会消失。输入数组值的正确方法是什么?

我的 schema.json 如下:

{
    "$schema": "http://json-schema.org/schema",
    "id": "HelloWorldSchematics",
    "title": "Hello World Options Schema",
    "type": "object",
    "properties": {
      "listName": {
        "type": "string",
        "description": "The name of the list.",
        "$default": {
          "$source": "argv",
          "index": 0
        },
        "x-prompt": "What's the name of list"
      },
      "colNames": {
        "type": "array",
        "items": {
            "type": "string"
        },
        "description": "The name of the columns.",
        "x-prompt": "What's the name of columns"
      }
    },
    "required": [
        "listName",
        "colNames"
    ]
}

【问题讨论】:

  • 你找到解决办法了吗?

标签: json angular-schematics


【解决方案1】:

我只能使用标志输入一个值。按照您的示例,您可以输入如下值:

schematics ./collection.json:HelloWorld --listName User --colNames={id,firstName}

请注意,数组元素之间没有空格。

以下不起作用:

schematics ./collection.json:HelloWorld --listName User --colNames={id, firstName}

【讨论】:

    猜你喜欢
    • 2018-03-26
    • 2023-03-02
    • 1970-01-01
    • 1970-01-01
    • 2020-05-11
    • 1970-01-01
    • 2013-10-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多