Enabling Dependency Injection for client side models bound to Aurelia enhanced razor views

As the example for this post I’ve decided that this page needs access to the Aurelia Router. The reason for this could for example be some interaction in the page where you’ll need to navigate the user away to some other route of the application. What we need to achieve is a version of the HomePersonClientModel that looks somewhat more like this:

Posting forms through ajax in any ASP.NET MVC application

In this post we'll take a short break from Aurelia and actually only use things that already should be at least somewhat familiar to most ASP.NET MVC developers. In my first post I made all navigation go through aurelias client side routing engine so what we need to do now is to ensure that any forms posted are posted async, a.k.a "through ajax". Note that everything I cover in this post could be used in any ASP.NET MVC site for forms that you want to post through ajax.

Connect the markup to a client side model when aurelia enhancing the server side rendered razor view

Our next step in creating this ASP.NET Core MVC/Aurelia hybrid application is to take the Aurelia enhancement of the razor views one tiny step further. In the previous post we made it possible to use any built in and custom aurelia attributes and elements within the razor views by "aurelia enhancing" the html we got back from the server. But what we didn't do in our enhance call is to include a model object that the markup can interact with through aurelia data and event bindings.