在嵌套对象上使用 Angular Typeahead
Using Angular Typeahead on Nested Objects
我正在尝试对嵌套对象数组使用 Angular Bootstrap Typeahead,但我不知道如何写出 typeahead。
我数组中的对象是这样的:
{
"category": "Locations",
"regions": [
{
"name": "Northeast",
"category": "region",
"states": [
{
"name": "New York",
"category": "state"
"cities": [
{
"name": "Syracuse",
"category": "city"
}
]
}
]
}
我只想return 名称值。那么我将如何写出来呢?
我目前正在写 <input ... typeahead=" filter.name for filter in filters| filter:$viewValue | limitTo:5">
与其使用 "in filters",不如使用 "in transformFilters()"
$scope.transformFilters = function () {
// Loop over filters and create an array of
{name: name, category:cat}
return my new array
}
我正在尝试对嵌套对象数组使用 Angular Bootstrap Typeahead,但我不知道如何写出 typeahead。
我数组中的对象是这样的:
{
"category": "Locations",
"regions": [
{
"name": "Northeast",
"category": "region",
"states": [
{
"name": "New York",
"category": "state"
"cities": [
{
"name": "Syracuse",
"category": "city"
}
]
}
]
}
我只想return 名称值。那么我将如何写出来呢?
我目前正在写 <input ... typeahead=" filter.name for filter in filters| filter:$viewValue | limitTo:5">
与其使用 "in filters",不如使用 "in transformFilters()"
$scope.transformFilters = function () {
// Loop over filters and create an array of
{name: name, category:cat}
return my new array
}