1

I am attempting to create a dropdown list in Angular containing sub-items (as in the image but with all options selectable). Does anybody please know how to achieve this in Angular using the < select > tag so that I don't have to change other code within my application, as I would if changing to an unordered list etc.

Thanks :)

dropdown list with sub-items

3 Answers 3

1

Consider using the groups of options provided by Angular/Material library. See the demo.

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

Comments

0

Use class= "dropdown-submenu"

<div class="btn-group dropdown">
  <button class="dropdown-toggle">Toggle</button>
  <ul class="dropdown-menu">
    <li>Item 1</li>
    <li>Item 2</li>
    <li class="dropdown-submenu">
      Sub List
      <ul class="dropdown-menu">
        <li>Submenu Item 1</li>
        <li>Submenu Item 2</li>
      </ul>
    </li>
  </ul>
</div>

or refer this https://mdbootstrap.com/support/general/how-to-create-a-nested-dropdown/

Comments

0

Grouping sub-items can be achieved using angular material library.

For multi select drop down you just have to add multiple property in select tag element for selecting multiple options.

see the stackblitz demo for reference.

For more such functionality using angular material, please refer angular material

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.