Simplifying the JavaScript Callback function for .NET developers

In JavaScript, functions are objects, and they can:

  • Be passed as an argument to another function
  • Return as a value from a function
  • Be assigned to a variable

Let’s assume that you have a JavaScript function (let’s call it function A) with the following properties:

  • Function A takes another function (let’s call this one function CB) as one of the parameters.
  • Function A executes the function CB in its body

In the above scenario, function CB is known as the Callback function. Let’s learn more about it using the following code:

Read full article on the Infragistics blog

Deep Dive Directives in AngularJS – Infragistics webinar on 29th May at 3 PM IST


Infragistics is on the mission to make the developers better worldwide and to do the same, Infragistics is happy to host one more webinar for the developers in the India time zone on the topic Deep Dive into Custom Directives in AngularJS

Webinar is on 29th May from 3 PM to 4 PM IST

Topic: Deep Dive into the custom directives in the AngularJS

Directives are one of the most important feature of AngularJS 1.X. Using the directives either we create new element on the view or give special meaning to the existing elements. There are many built in directives are provided us to use as it is. For example ng-app, ng-repeat, ng-controller, ng-show etc. AngularJS provided directives mainly perform the following tasks,

  • Manipulate the DOM
  • Perform Data Binding
  • Attach specified behavior to DOM elements
  • Creates new DOM element
  • Handle events
  • Modify CSS
  • Validate data etc.

There would be scenario when you would write custom directives. In this webinar along with the AngularJS provided directives, we will deep dive into custom directives. We will cover following topics in the webinar,

  • Directives and usage of built in directives
  • Custom directives
  • Shared , Inherited and Isolated Scope in directives
  • Controller in directives
  • $complie and link function
  • Transclusion

To be a productive and efficient AngularJS developer one should have good understanding of the directives. In this webinar we will learn these topics related to the directives.

I am happy that I will be hosting the webinar. To join Register here

Objects in JavaScript for .NET developers – Part 1

Read full article on the Infragistics blog

Here are some fun facts for you: JavaScript is not an object oriented language, but almost everything in JavaScript is an object. JavaScript does not have classes, and we can create an object from an object. A function can be used as a constructor, and returns a newly created object. Every object in JavaScript contains a second object called a prototype object.

If you’re coming from a .NET background, the sentences you just read probably don’t make any sense. But these are all true statements about JavaScript. And in this post we will focus on different ways to create objects in JavaScript

  1. Object as literal
  2. Creating an object using the new operator and constructors
  3. Creating an object using the Object.create() static method
Object creation as literal

The simplest way to create an object is by creating an object using the object literal. We can create a simple object as shown in the listing below:

Read full article on the Infragistics blog

How to use AngularJS in ASP.NET MVC and Entity Framework

Read full article on the Infragistics blog

These days, it seems like everyone is talking about AngularJS and ASP.NET MVC. So in this post we will learn how to combine the best of both worlds and use the goodness of AngularJS in ASP.NET MVC by demonstrating how to use AngularJS in an ASP.NET MVC application. Later in the post, we will see how to access data using the Entity Framework database as a first approach, then we’ll explore how to access the data in AngularJS and then pass to the view using the controller. In short, this post will touch upon:

  • adding an AngularJS library in ASP.NET MVC;
  • · reference of AngularJS, bundling and minification;
  • · fetching data using the Entity Framework database;
  • · returning JSON data from an ASP.NET controller;
  • · consuming JSON data in an AngularJS service;
  • · using AngularJS service in AngularJS controller to pass data to the view; and
  • · rendering data on an AngularJS View

To start, let’s create ASP.NET MVC application and right click on the MVC project. From the context menu, click on Manage Nuget Package. Search for the AngularJS package and install into the project.

Read full article on the Infragistics blog

How to share data between controllers in AngularJS


In my AngularJS classes, I often get asked, “How do I share data between the controllers in AngularJS?” On the Internet, there are many solutions suggested. However, I prefer to share data using the Shared Data Service method, and that’s what we’re going to explore in this post.

To start with, let’s suppose that we want to share a Product object between the controllers. Here I have created an AngularJS service named SharedDataService as shown in the snippet below:

Read full article on the Infragistics blog