Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

mat-select drop down Angular with Metonic theme


I have issue in displaying drop dowm data within input form. Once I select drop down its showing in background. My code is below. Please advice.


<div class="modal fade" id="kt_modal_add_customer" tabindex="-1" aria-hidden="true">
<!--begin::Modal dialog-->
<div class="modal-dialog modal-dialog-centered mw-650px">
<!--begin::Modal content-->
<div class="modal-content">
<!--begin::Form-->
<form [formGroup]="formData" class="form" action="#" id="kt_modal_add_customer_form" >
<!--begin::Modal header-->
<div class="fv-row mb-7">
<!--begin::Label-->
<label class="required fs-6 fw-semibold mb-2">Lead Targets</label> <br/>
<mat-select class="form-select" [formControl]="custCtrl" placeholder="Data" #singleSelect>
<mat-option >
<ngx-mat-select-search
[formControl]="custromerFilterCtrl"
></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let customer of filteredCustomers | async" [value]="customer">
{{customer.Name}}
</mat-option>
</mat-select>
<!--end::Input-->
</div>
</form>
<!--end::Form-->
</div>
</div>


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (3)


Hi Faqru,

Ensure that you have imported the necessary modules in your Angular module file. Make sure you have imported MatSelectModule and FormsModule from '@angular/material' and '@angular/forms', respectively.

Double-check if there are any conflicting styles or CSS rules that may be affecting the display of the dropdown. Inspect the browser's developer tools to identify any potential CSS conflicts or layout issues.

If the issue persist, please provide more details or any error messages you may be encountering for further assistance.

Thanks



Hello Faizal,

Thanks for your reply. I can see drop down from mat selection and everything I import correctly. I tested in normal html with angular ts and it works as expected. But once I use matselection in html <form class="form" action="#"> the results is different. It shows dropdown in the background not within the kt_modal_new_target_form. Please find below links for output and html code. I need drop down selection within the creation form.

https://drive.google.com/file/d/1enFj9hUSETYbz_oL6EEIeVJs7kz2sT6F/view?usp=share_link

https://drive.google.com/file/d/1NsB_1_d6mkwKincgNBa6npwrV-tC4nIP/view?usp=share_link



Hi Faqru,

Based on the information provided, it seems that the issue you are facing is related to the positioning or z-index of the dropdown menu within the modal. Here are a few suggestions to resolve the problem:

1. Ensure that there are no conflicting CSS rules or styles that are affecting the positioning of the dropdown. Inspect the CSS styles applied to the dropdown and the modal to identify any conflicts. You can use browser developer tools to help with this.

2. Try explicitly setting the z-index of the dropdown menu to a higher value than the modal or other elements that might be overlapping. You can do this by adding a CSS class to the dropdown and applying the z-index property. For example:


.dropdown-menu {
z-index: 9999;
}


3. Make sure that the modal is correctly positioned and doesn't have any conflicting styles that might be affecting the dropdown. Check if there are any CSS rules that set a higher z-index for the modal or its parent elements.

4. To isolate the issue, try using the mat-select component outside of the modal and see if it works correctly. This will help determine if the issue is specific to the modal or related to the mat-select component itself.

If the issue persists, please provide more details about the specific output and the HTML code you mentioned, including any error messages or console logs. Additionally, sharing relevant CSS styles applied to the modal, dropdown, and their parent elements would be helpful in diagnosing the problem further.

This similar issue could help.
https://stackoverflow.com/a/56442951

Hope this helps! Let me know if you have any further questions.

Thanks


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(