1

我目前正在使用 angular-schema-form-dynamic-select,我的要求是根据所选国家/地区选择州。我将数据存储在数据库中,例如 this country -> state -> city。谁可以帮我这个事?

这是我的表格:

[
  {
    "key": "country",
    "type": "strapselect",
    "placeholder":"country",
    "options": {
      "httpGet": {
        "url": "/countries" 
      },
      "map": { "valueProperty": "readonlyProperties.id", "nameProperty":"name" }
    }
  },
  {
    "key": "state",
    "type": "strapselect",
    "placeholder":"state",
    "options": {            
      "httpGet": {
        "url": "/states"         
      },
      "map": { "valueProperty": "readonlyProperties.id", "nameProperty":"name" }
    }
  },
  {
    "key": "city",
    "type": "strapselect",
    "placeholder":"city",
    "options": {
      "httpGet": {
        "url": "/cities"
      },
      "map": { "valueProperty": "readonlyProperties.id", "nameProperty":"name" }
    }
  }
]
4

2 回答 2

0

我认为这样的功能确实非常方便。也许你在 json 字符串中写了这样的东西:

{
    "type": "object",
    "properties": {
        "country": {
            "type": "string",
            "enumCallback": "getTitlesValues()"
        }
    }
}

在您的控制器中,您将定义该回调:

...
$scope.getTitlesValues = function () {
    return ['India','Australia', 'Germany', 'Sweden']
}
...
于 2017-02-09T13:00:38.160 回答
-1

我认为这样的功能确实非常方便。也许你在 json 字符串中写了这样的东西:

        {
        "type": "object",
        "properties": {
        "country": {
        "type": "string",
        "enumCallback": "getTitlesValues()"
           }
         }
       }

在您的控制器中,您将定义该回调:

             ...
            $scope.getTitlesValues = function () {
            return ['India','Australia', 'Germany', 'Sweden']
           }
            ...
于 2017-02-09T12:57:34.677 回答