Last post Dec 04, 2019 04:48 PM by MarkHaroldson
Dec 04, 2019 04:48 PM|MarkHaroldson|LINK
I have run into a problem where it appears that the onlick event for a button is not being handled correctly when the control is in a shared component library.
The following component works as expected when it is deployed in the main project. But when copied to a shared class library the click event does not fire.
<button class="btn btn-primary"
button test shared
private void DoClick()
This may or may not be related but.... For my controls I am using the code behind pattern (@inherits). When I use the code behind pattern in a shared library and use @onclick I get the following error.
blazor.webassembly.js:1 WASM: Microsoft.JSInterop.JSException: Failed to execute 'setAttribute' on 'Element': '@onclick' is not a valid attribute name.
If I use plain old "onclick" I get the following error
(index):1 Uncaught ReferenceError: DoClick is not defined
at HTMLButtonElement.onclick ((index):1)
These issues seem to be limited to situations where the component is deployed in a shared library.