Microsoft.JSInterop.JSException: 'Cannot read properties of undefined (reading 'closest') Blazor
Any new page that I add outside of the ones that the template already has, throws me that error, do I have to modify a specific file? this error happens in MasterInit.razor
Stack
Microsoft.JSInterop.JSException: 'Cannot read properties of undefined (reading 'closest')
TypeError: Cannot read properties of undefined (reading 'closest')
at _getItemParentElement (http://localhost:5170/assets/js/scripts.bundle.js:1938:24)
at _getItemParentElements (http://localhost:5170/assets/js/scripts.bundle.js:1959:22)
at _setActiveLink (http://localhost:5170/assets/js/scripts.bundle.js:2251:27)
at KTMenu.the.setActiveLink (http://localhost:5170/assets/js/scripts.bundle.js:2406:16)
at KTMenu.updateByLinkAttribute (http://localhost:5170/assets/js/scripts.bundle.js:2657:26)
at http://localhost:5170/_framework/blazor.server.js:1:3501
at new Promise ()
at kt.beginInvokeJSFromDotNet (http://localhost:5170/_framework/blazor.server.js:1:3475)
at http://localhost:5170/_framework/blazor.server.js:1:72054
at Array.forEach ()'
Regards
Replies (1)
Hi,
Unfortunately, we are not able to reproduce this error. If there are any steps on how to reproduce it please describe them.
To add a new page you can do the steps below:
- Create you page .razor component inside Starterkit/Pages folder.
- Place line @page "/your-page-route" on the top of you file.
- Then add your page view markup.
Example of file:
@page "/your-page-route"<h1>You page content</h1>
Regards,
Lauris Stepanovs,
Keenthemes Support Team