Category

Angular

AngularJS

Angular, Web

Custom control validation in Angular

Validation is an integral part of a web application. Making sure that a first validation pass is done on the client side can (to some extent) help you cleanse your data and show useful messages to your users when the input data is invalid. Angular comes with a pre-determined set of validators, and you can find find some validators libraries on GitHub, but sometimes this is not enough as you need custom rules for validating your data. Since form validation can occur through reactive forms or template driven forms, let’s go over each of them to see how we can add a custom validator in each case. Custom validator through reactive forms Validation can occur on a formControl or on a…

Read more
Angular, C#, Web

Secure your Angular/ASP.NET Core application with Anti-forgery token

Security has always been at the forefront of Web Applications. There are so many security concerns one has to think of when developing web applications. Today, I want to share with you guys how to secure a Single Page Application (SPA) from Cross-site request forgery (CSRF or XSRF) using Angular 4. If you’re still using Angular 2 this works as well but I recommend upgrading to 4. It’s easy and they made the code faster and smaller (maybe a topic for another day ;-]) By default, the Angular core HTTP library will look for a token in the cookie with the name XSRF-TOKEN and add it to the request. Thanks to the CookieXSRFStrategy provided by Angular, Angular does that part for you. However,…

Read more
Angular, Web

Demystifying a few Angular2 concepts for starters

Being immersed in the JavaScript frameworks world can be intimidating. Today, I will try to demystify a few concepts and perhaps at the same time answer some questions that someone starting with Angular2 will most probably have. The framework is mature enough at this point in time to be able share some of the basics, but useful, things that one should have in mind when using it. Angular2 uses TypeScript TypeScript is a subset of JavaScript that is strongly typed, unlike JavaScript which is dynamically typed. Without going into too much details, it basically means that the compiler will not let you put a type into another. For instance, assigning a number (may it be a short, int, double, etc) to a…

Read more
Angular, React, Web

Angular2 or React in the business environment

In 2015 and 2016, React was at the top of front end libraries for creating reusable components. AngularJS (Angular 1) was being slowly left behind; the Google team after 5 years of development learned from the users and came out with Angular 2. The framework was rewritten completely and it really is an amazing accomplishment. As a software architect, a key task of my job is to evaluate the current and future tools, frameworks and libraries out there and see if one of more could potentially be a fit for the development team. As you probably know, they are a lot of articles comparing both React and Angular 2. As a user of both, I want to share with you my findings….

Read more