Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

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">

share|improve this question
up vote 1 down vote accepted

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

  }
share|improve this answer
    
That worked. Thank you! – Obsanity Oct 21 '15 at 21:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.