In this article we are not discussing how to develop forms in Angular 2, we are going to discuss how to write a custom validator for Angular 2 forms. Forms API in Angular 2 has some built-in validators already, here is an model driven form example with built-in required validator.
I am using Underscore.js from long time, it’s a JavaScript library that provides useful functional programming helpers without extending any built-in objects. I recently came across it’s templating capabilities. Underscore provides _.template() function to dynamically build markup from a template and some data(JavaScript objects). Here is the syntax: _.template(templateString, [settings]) _.template() compiles JavaScript templates into functions…
It is very simple with HTML5 Canvas API, it provides toDataURL() method. The toDataURL() method of the canvas object converts the canvas drawing into a 64 bit encoded PNG URL. We can pass “image/jpeg” as argument to toDataURL() method, to get image data URL in the jpeg format. Here is the code snippet which explains…
The $http service is a core angular service that helps in consuming web services (either REST or SOAP) via the browser’s XMLHttpRequest object or via JSONP . $http service is similar to jQuery $.ajax() method. Here is the syntax of $http service : The $http service is a function which takes a single argument that…
I was working with AngularJS from couple months. I came across some new features in AngularJS 1.2. I am going blog about this new features. AngularJS 1.2 introduces new “controller as” syntax. This syntax helps us to abstracts the use of $scope in controllers, simplifying the syntax of controllers, html markup. Let’s have a look…