0

I am using this Angular Module but I can not get the work with nested data.

Here is my PLUNKR my output shows country when using object-property="country but when I try to show only states, it doesn't work.

      <div class="mrg-top50">
    <label>1. Autocomplete field - options list as array of objects</label>
    <multiple-autocomplete ng-model="skills" object-property="country" suggestions-arr="skillsList"></multiple-autocomplete>
    <label>Selected Model Value :          <br />
    </label>
   {{skills}}
</div>
2
  • You could create a new variable in your controller to load the states instead of trying to access it from an object property Commented Jan 16, 2017 at 17:39
  • Please provide all relevant code in an minimal reproducible example in the question itself, not on a third-party site. Commented Jan 16, 2017 at 18:03

1 Answer 1

1

I could do it in your fiddle like this:

    <multiple-autocomplete ng-model="skills" object-property="labels" suggestions-arr="skillsList[0].states"></multiple-autocomplete>

Though this is really dependent on the [0] index , which means only useful when you have just one element in the given array like in the given example.

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

2 Comments

Thank you, this will work just find, since I have only one index element in the array.
Glad it helped.

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.