Skip to content

Page fails to load using MatAutocompleteList inside MatDialog EditForm #430

Closed

Description

@tkennedy13

I am trying to use an MatAutocompleteList on a dialog edit form and the page crashes every time with the following errors showing in the dev console.

image

I copied the code from the sample into the root of my page and tried

<MatAutocompleteList Items="@options2" TItem="Car" Label="Select car" CustomStringSelector="@(i => i.Name)" @bind-Value="@value" />

and

<MatAutocompleteList Items="@options2" TItem="Car" Label="Select car" CustomStringSelector="@(i => i.Name)" @bind-Value="@value">
     <ItemTemplate>
         <div style="display: flex; flex-direction: row; width: 100%;">
              <div style="flex: 1;">@context.Name</div>
             <div style="width: 150px;">@context.Price$</div>
        </div>
    </ItemTemplate>
</MatAutocompleteList>

and both autocomplete's loaded. When I put the same code inside of a

<MatDialog @bind-IsOpen="@dialogIsOpen">
	<MatDialogTitle>Create</MatDialogTitle>
	<MatDialogContent>
		<EditForm Model="@obj" OnValidSubmit="@CreateObj">
			<DataAnnotationsValidator />
			<ValidationSummary /> 
			<MatAutocompleteList Items="@options2" TItem="Car" Label="Select car" CustomStringSelector="@(i => i.Name)" @bind-Value="@value" />
		</EditForm>
	</MatDialogContent>
	<MatDialogActions>
		<MatButton OnClick="@(e => { dialogIsOpen = false; })">Cancel</MatButton>
		<MatButton OnClick="@CreateObj">Create </MatButton>
	</MatDialogActions>
</MatDialog>

it consistently gives the above referenced errors and the razor page will not load.

Activity

  1. tkennedy13 commented on Feb 14, 2020

    @tkennedy13
    Author

    Here is a related pull request. I didn't see this prior to opening this issue. #316

  2. self-assigned this
    on May 6, 2020
  3. added a commit that references this issue on May 15, 2020
  4. enkodellc commented on May 16, 2020

    @enkodellc
    Collaborator

    Merged fix into develop branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions