Categories
Angular 2

Angular 2 – Async Validator – Username/email availability check

In this post I will show you, how we can create custom async validator to check for email availability, same logic you can apply for username or other async validations. Lets create a component: Here is my user service: Backed server response for unregistered email will be null and for registered email address will be […]

Categories
Javascript

ECMAScript 2016 – Finding if a value exists in an array using JavaScript

We gonna use ECMAScript 2016’s new includes() method to determine whether an array contains a specific element. The new method includes(searchElement, fromIndex) function searches an array for a specific value and returns the corresponding boolean, return true if it exists otherwise false. An optional argument fromIndex allows to search from a specific index. Let’s see […]

Categories
Javascript

JavaScript Promise API

Promises can replace the asynchronous use of callbacks, and they provide several benefits over them. Basic Promise Usage A new Promise is created with the new Promise() constructor and the promise provides resolve and reject functions to the provided callback. The fulfillment of the promise is simply logged, via a fulfill callback set using then() […]

Categories
Javascript

JavaScript const keyword

In my previous post I wrote about let keyword, in this post I would like to write about another new ECMAScript 6 keyword, const. There is no much difference between const and let, both works similar way , both are having same level of scope. Which means constants which are declared with const keyword are […]

Categories
Javascript

JavaScript let keyword

In this tutorial I will introduce you to new ECMAScript 6 let keyword. Variables declared with let keyword behave like other languages variables. These variables are unlike to the variables which are declared with var keyword. Let me show you example… let Variables which are declared with let statement are block scoped local variables which […]

Categories
Javascript

JavaScript measuring execution time

JavaScript performance is becoming increasingly important, it is good to know basic instrumentation techniques. One of the basic instrumentation tool is console.time and console.timeEnd. console.time() starts a new timer with an associated label. When console.timeEnd() is called with the same label, the timer is stopped and the elapsed time is displayed in the console. Timer […]

Categories
Javascript

Array.from Function

ECMAScript 6 supports a generic Array method for converting an array-like object into one of its own.It is Array.from(). This method is very useful while converting iterable objects to arrays, code will be much cleaner and no need to use split or slice hacks. It has the following syntax: Array.from (arrayLike [ , mapfn [ […]

Categories
AngularJS

AngularJS – IsArray function

AngularJS isArray() is one of the useful ng function. This function is used to identify if a reference is array or not. This function return Boolean which means , it will return true if the reference is an array, return false if the reference is not an array. Syntax: angular.isArray(value); Example:

Categories
Javascript

JavaScript Module Pattern

Design patterns offer developers ways to solve technical problems in a reusable and elegant way. Probably module pattern is the most used and widely accepted JavaScript pattern and you’ve probably used it before without realizing it. Basically by using this pattern you can modularize your application and you can provide public and private access to […]

Categories
Javascript

Namespace in JavaScript

In this post i would like to explain about JavaScript Namespaces. Namespaces is nothing but grouping different functionality under the single unique name.As we know in JavaScript everything is in global scope so there are high chances to overriding functions(defining functions with same name more then one time). To avoid ambiguity and minimize the risk […]

Categories
Javascript

JavaScript – encodeURI() vs encodeURIComponent()

The purpose of the tutorial is to show you the differences between encodeURI() and encodeURIComponent() functions. encodeURIComponent() This method will encode the given string , and if you pass the encoded string to decodeURIComponent(), it will return the original string. This method will not encode following characters ~!*()'” and it will encode all the characters […]

Categories
Javascript

Web Notifications API

Web notifications API was designed to display END user notifications(desktop notifications), which allows alerting the user outside the context of a web page. This API is really very useful to show real time notifications like new email notifications, new tweet notification, new message notification ..etc, but the only thing we need to remember is the […]

Categories
AngularJS

Dependent Dropdown List with AngularJS

Here the simple AngularJS tutorial on creating Cascading DropDownList with Angular JS.

Categories
AngularJS

How to assign alternate class to rows in Angular JS?

In this post i would like to write about Angular JS ngClassOdd,ngClassEven directives , by using this directories we can take effect only on odd rows or on even rows. This directives work exactly as ngClass and this directives only work when they are in scope of an ngRepeat. For example by using ngClassOdd,ngClassEven directives […]

Categories
AngularJS

Custom filters in AngularJS

This tutorial will show you, creating your own custom filters in AngularJS with simple steps and example. Angular filters provides a way to format the variable output without changing scope variable. Whenever possible use filters to keep presentation logic out of the controllers. Angular providing a .filter() method for each module. We can write your […]