Real-time Data update with Angular.js, Node.js and

We have posted Real-time Data update with Angular.js, Node.js and previously.This article is a proof of concept towards make a real time web application with Javascript based Web Server Node.js and help writing an apa research paper Express.IO with Angular.js.The application is same as the previous one ,but this time it is build up with Express.IO.

We have simulated a situation with 4 Product with their Best Buy Price, Best Sell Price and Last Trade Price.

Real-time Data update with Angular.js, Node.js and

To make this possible, we have selected –

1> Angular.js for client side development – Application Front End

2> Node.js for server side development

3> Express.IO for Server and Client Communication.

4> Node.js Express.IO module extention.

We have created a Proof of Concept with Javascript based web server Node.js, where we have focused on dealing with Express.IO for real time application and angular.js on client side.

Architecture at a glance –

Angular.js NodeJS SocketIO

So here are the steps –

Installation –

A> Download and install Node.js from here.

B> To Develop the application we need to install module for Node.js

Command – go to site npm install (should be connected to internet)

Configuration Code –

Now, we will try to describe the code portion –

var http = require('http');
var url = require('url');
var fs = require('fs');

// use
express = require('');
var app = express().http().io();

Here we have initialised the http, url and filesystem object within javascript variables in respect of Node.js concept.

Also we have initialised buy phd degree online variable in the Node.js Environment.

	var path = url.parse(req.url).pathname;
	fs.readFile(__dirname + path, function(err, data){
		if (err){ 
			return send404(res);
		res.writeHead(200, {'Content-Type': path == 'json.js' ? 'text/javascript' : 'text/html'});
		res.write(data, 'utf8');

Here, we are giving access to the resources from the node.js server – “ follow angulartableRT.html” for the client browser.

Now the server is listening on port 8001

Reader will get the whole code in next GITHUB, which is linked at the end of Post.

Now the most important one is – communication from Node.js. We have commented below the node.js specific code.

 go to link  
// define interactions with client'ready', function(req){
   admission essay custom writing do   //send data to client
		for(i=0;i // A simulation of data from server instead of database calling
			serverjson[i].BBP = Math.round((parseInt(serverjson[i].BBP) + Math.random())*100)/100;
			serverjson[i].BSP = Math.round((parseInt(serverjson[i].BSP) + Math.random())*100)/100;
			serverjson[i].LTP = Math.round((parseInt(serverjson[i].LTP) + Math.random())*100)/100;
		var serverjsonstr = JSON.stringify(serverjson);'msg', {'msg': serverjsonstr}); // Emitting Messages from Server'showMsg', {'msgWrite':msgWrite});
    }, 1000);

});'client_data', function (req) { home page //receiving what sent from client side
	 console.log(; dissertation protection consentement mariage //printing cliend data in console
	 msgWrite =;'showMsg', { //sending back to client 

Now run follow url node server.js from command shell. This is our node.js specific code file.

Our sample application will be  – http://localhost:8001/

Angular.js part –

Below is the code in Angular Controller and the related code is discussed.

/* Controllers */
apps.controller('StockListCtrl', function($scope, express) { 
  $scope.stocks = [];
  express.on('msg', function(data) {  // Listening in Socket in Angular Controller
		$scope.stocks = JSON.parse(data.msg);

//Getting value from server data change event
apps.factory('express', function($rootScope) {
	var express = io.connect();// Connection to the server
	return {
		on: function(eventName, callback) {// Return callback to the actual function to manipulate it.
			express.on(eventName, function() {
				var args = arguments;
				$rootScope.$apply(function() {
					callback.apply(express, args);

Angular HTML Binding

 <script src="http://localhost:8001/"></script> // Important to know
 // Access from Angular.js 

Below is the dynamic binding of Angular HTML with the Controller –

<body ng-controller="StockListCtrl">
          <table class="table">
                   <tr ng-repeat="stock in stocks"> <!-- Dynamic Binding of Angular Template with Data -->

Reader can download the complete source-code in GitHub.

If you find this article helpful, you can connect us in Google+ and Twitter.

Enter your email address:

Delivered by FeedBurner

Leave a Reply

Your email address will not be published. Required fields are marked *