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

,

Leave a Reply

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