Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page fails to load using MatAutocompleteList inside MatDialog EditForm #430

Closed
tkennedy13 opened this issue Feb 14, 2020 · 2 comments
Closed
Assignees
Labels

Comments

@tkennedy13
Copy link

tkennedy13 commented Feb 14, 2020

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.

@tkennedy13
Copy link
Author

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

@SamProf SamProf self-assigned this May 6, 2020
sandrohanea added a commit to sandrohanea/MatBlazor that referenced this issue May 15, 2020
@enkodellc
Copy link
Collaborator

Merged fix into develop branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants