What is AngularJS SQL

Sometimes, we need to display information on the web page dynamically. There may be the cases when data is being collected on regular or irregular intervals. In those situations, data is fetched from third party locations in form of interoperable notations using exposed services.

Now the question is “Does AngularJS support this feature and can it help us to give solution in this case?”

The answer is YES!

Data source is situated at remote location to our AngularJS application. So we need a language or special notion which can be transmited and understood by AngularJS.

That special light weighted notation is JAVA SCRIPT OBJECT NOTATION (JSON). Remote web service returns data in JSON formation, which is consumed and post compilation it is used by AngularJS application.

Hence AngularJS is perfect to display data from database provided data should be in JSON format. As AngularJS is JavaScript based framework, it works for PHP, ASP.Net and many more…

In this article, we are considering ASP.NET for demonstration.

Assume it that we have a table in SQL Server with data which is represented below:

Data Source

Location Country
Delhi India
New York USA

We need a web service which provides above data in JSON format. Let’s say:

Web Service

http://hostname/locations.aspx

It returns data in JSON format as below:

{“records”:[ { “Location” : “Delhi”, “Country” : “India” }, { “Location” : “New York”, “Country” : “USA” } ]}

Above mentioned URL can be used in AngularJS application using AngularJS service $http.

AngularJS Application

Output

Delhi India
New York USA

 

Let’s see, how is the code of locations.aspx written?

 

Be  Connected…

Satyendra Mishra

,

About Satyendra Mishra

Satyendra is a Technical Project Manager with 12+ years of experience on Project Management, Microsoft Technologies including ASP.NET, ASP.NET MVC, C#, SharePoint (On premises & Office 365), JavaScript Framework (AngularJS) and related technologies. He is a person with belief, sky is limit for a hard working and dedicated individual. That’s why he devoted himself to field of Software Development and now both are growing with each other. Every year for him turned out to be best year and he received enormous support and love from his companies and his clients from around the world. Now with vast knowledge of software development and its outsourcing process, he decided to move himself into knowledge sharing. Keep a fact in your mind about the comfort level of your clients and this will make you king/queen of your area.
View all posts by Satyendra Mishra →