0

We need to populate a dropdown containing countries and if Locales are present in respecitve country then populate one more dropdown using underscore template.

var countrySelectorTemplate = '<select class="form-control"><% _.each(resultsData.Countries, function(results) { %> <option><%= results.CountryName %></option> <% } ) %></select>';

JSON is available on http://jsfiddle.net/ylokesh/4NbGL/

As of now, it populates the select dropdown with countries. How can i put nested condition to populate one more dropdown if locales are present for respective country?

1 Answer 1

0

What about

var countrySelectorTemplate = '<select class="form-control"><% _.each(resultsData.Countries, function(results) { %> <option><%= results.CountryName %></option> <% if ("Locales" in results) { %> "Another Dropdown" <% }<% } ) %></select>';
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.