0

I'm trying to use Angular Bootstrap Typeahead on an array of nested objects and I cannot figure out how to write out the typeahead.

My objects in my array are like so:

{
  "category": "Locations",
  "regions": [
    {
      "name": "Northeast",
      "category": "region",
      "states": [
        {
          "name": "New York",
          "category": "state"
          "cities": [
            {
              "name": "Syracuse",
              "category": "city"
            }
          ]
        }
      ]
    } 

I only want to return the name values. So how would I go about writing this out? I currently am writing <input ... typeahead=" filter.name for filter in filters| filter:$viewValue | limitTo:5">

1 Answer 1

1

Rather than using "in filters" just do something like "in transformFilters()"

  $scope.transformFilters = function () {
      // Loop over filters and create an array of
          {name: name, category:cat}

     return my new array

  }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.