I was tasked at work with making my client’s Blazor Web Server app internationalized. It was quite an easy task; that is, until I had to localize the error messages from validation attributes (which are used a LOT throughout the app). I looked for an answer for ages, because I just couldn’t accept what was …
Continue reading Problem solved: Localization and Validation Attributes
Category:Uncategorised
ASP.NET Core hosted React UI with Aspire
The template doesn’t work for me as-is. Here is how to fix it You can now run your AppHost project and see the React app listed, running, and with a valid URL exposed.
Preventing Dialog boxes obscuring Blazor-Server connection status
When a Blazor-Server application loses connectivity from the browser with the server, it displays a semi-transparent obscuring layer and a message informing the user it is trying to reconnect. My most recent release of Morris.Blazor.Web.Modal uses the HTML <dialog> element to ensure users cannot tab to controls beneath the currently focused Modal window. The problem …
Continue reading Preventing Dialog boxes obscuring Blazor-Server connection status
Avoid returning index.html for API calls
While writing an asp.net hosted Blazor WASM app, I’ve noticed that when I call an API on my server I receive the contents of index.html when I am expecting a 404 error. TL;DR Explanation When you first request a URL from the host and nothing is found at that address, the server will serve the …
Continue reading Avoid returning index.html for API calls
Tom Lehrer adds newly discovered elements to his song The Elements
After many decades of writing his famous song The Elements, I’ve inspired Tom Lehrer to add the newly discovered elements!
Blazor-Fluxor ranked #7 in top 10 Blazor tools!
I was really pleased to see my Blazor library “Fluxor” mentioned in this Visual Studio Magazine article!!!
Assigning a piped async result to a variable in an Angular view
If you have an Observable<x> in your component you might find yourself doing something like this {{ ( source$ | async)?.property1 }}{{ ( source$ | async)?.property2 }} This will subscribe to the source$ observable more than once. A commonly used technique to avoid this is to assign the result of the async into a view …
Continue reading Assigning a piped async result to a variable in an Angular view
Implementing a really simple Elvis Operator in TypeScript
Here is a simple routine that implements what is known as the Elvis Operator in TypeScript. In C# you can write code like thisNullable<int> age = person?.BestFriend?.Mother?.CurrentHusband?.Age); If any of the values along the way it will return a null rather than throwing a NullReferenceException. Using the class in my previous blog Get a Lambda expression …
Continue reading Implementing a really simple Elvis Operator in TypeScript
A type safe way of creating Angular ReactiveForms and FormGroups
If, like myself, you prefer as many of your coding mistakes to be identified at compile time as possible then you might like the following example. The FormBuilder in Angular expects us to identify our FormControls with a string name. If ever the API of your server changes then of course the names of those …
Continue reading A type safe way of creating Angular ReactiveForms and FormGroups
Failed to execute ‘send’ on ‘XMLHttpRequest’: Failed to load ng:///DynamicTestModule – Solved (Angular testing)
If when you run your tests you see an error similar to this Failed to execute ‘send’ on ‘XMLHttpRequest’: Failed to load ‘ng:///DynamicTestModule/xxxxxxComponent_Host.ngfactory.js It means something in your component is throwing an exception and the test framework is returning a wrapped exception. To see the actual exception run ng test with -sm=false as a parameter …
Continue reading Failed to execute ‘send’ on ‘XMLHttpRequest’: Failed to load ng:///DynamicTestModule – Solved (Angular testing)
