Before continuing my endeavour to share how I’ve “hybrided” together ASP.NET Core MVC and Aurelia I’d like to share just a few words and some links on why I decided to go with Aurelia.
Some background is that late fall 2016 I decided it was time to move from my current work position and what I found – and got – was a position at a small company that had plans to completely rewrite their entire platform for schools (currently in ASP.NET WebForms) in ASP.NET Core. They were looking for someone to take on a main responsibility for the front end development as that historically had been something they had lacked focus on. During the interview there were some talking about Angular but they made clear nothing about it was written in stone.
So back to the question at point; Why Aurelia? Let me be the first to admit that this was not something I spent a huge amount of time on. However, as preparation for my new work I started to look around. I did some brief reading on Angular (yes, “Angular 2”, in case you were unsure), had a look at some frontend markup examples and I just didn’t feel exited about it. It felt complex, and quite frankly some of the syntax just looked ugly.
I also had a desire to be able to use some of the features in ASP.NET MVC, for example the validation model that makes it really easy to ensure input are validated both on the client and server. I’m sure there are lots of other models for this but this was the one I knew about and wasn’t so keen on leaving behind. Also I wasn’t so hold up by the whole single page application hype, rather I was looking for something more along the lines of “let’s add client side features when there really is a point, but for those really simple informational views MVC Razor views (with a strongly typed Model object) are darn sweet :-D”. (In fact, the stuff I presented in my initial post wasn’t even part of my plan in the beginning, and I’ll come back in a later post on alternative versions of the aurelia-enhancer and AureliaEnhanceTagHelper for use in an MVC application where each action/page/view is loaded as a full request.)
To wrap it up, I just reached the conclusion that Angular wasn’t a good fit for what I wanted to accomplish. And I have no problem admitting that at the time this was based more on a gut feeling than facts.
Somehow, I can’t remember exactly how, I stumbled upon Aurelia. I read some articles, tried it out a bit, and what really made the penny drop for me was definitely reading about Aurelias firm plans on being standards compliant but especially reading the documentation section on Leveraging Progressive Enhancement. I mean wow! As I had some previous experience with KnockoutJS this just instinctively seemed to be a dream come true. Imagine doing “applyBindings” (“enhance” in Aurelia) on a part of markup, making it bound to a plain old json object! No fuzzing about with observables this, observables that. No objects where all properties are methods, no super long data-bind attributes that are so easily mistyped and all that kind of stuff that makes KnockoutJS a bit quirky to work with. And I could directly envision this markup coming from a .cshtml razor view and started thinking about how I could weave these two worlds together. I was hooked and what I’ve found since is what I’ll be sharing right here in this blog.
To finish this off I’d like to share an article I found just the other day. The article it self is pretty unpartial, but let me just say it still made me even more convinced about the question of Aurelia vs Angular; Aurelia vs. Angular 2 — A Code Comparison.
If you liked this post, please click thumbs up and don’t hesitate to make any comments, questions or other remarks.