You must Sign In to post a response.
  • Category: ASP.NET

    Issue in angular js in html page

    I am new to angular js. Please find the below script which I used in html page.
    Web api is working fine and it is returning data as JSON format.


    var app = angular.module('PatientApp', []);

    app.controller('PatientController', function ($scope, $http) {

    $http({ method: 'Get', url: 'http://localhost:53193/api/patient' }).success(function (data) {
    $scope.patients = data; // response data
    error(function (data) {


    when I ran this script in html page, it is not even coming into this script

    Can you please let me know what is the issue here.
  • #767003

    <div ng-app="">

    <p>Name: <input type="text" ng-model="name"></p>
    <p>You wrote: {{ name }}</p>


    refer this url

    Name : Dotnet Developer-2015
    Email Id :

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #767013
    First check following reference exist in your application or not:

    <script src=""></script>

    After that check whether you had provided method name inside API call:
    $http({ method: 'Get', url: 'http://localhost:53193/api/apiname/apimethodname' }).

  • #767015
    Following may be some possibilities,
    1. You may miss some js file. Make sure you included all the required js files.
    2. The URL http://localhost:53193/api/patien may have issue, that may not work properly.
    3. Check your entire page, and make sure you formatted the page properly some times you may miss "{" or "(". We may not notice that at the run time.

    By Nathan
    Direction is important than speed

  • #767085
    Let me clear some points about JSON and read its input using JavaScript
    A common use of JSON is to read data from a web server, and display the data in a web page, JSON data is written as name/value pairs. Curly brackets indicates objects and square for Array
    here is basic syntax

    {"fname":"abc", "lname":"xxx"},
    {"fname":"pqr", "lname":"yyy"},
    {"fname":"lmn", "lname":"zzz"}

    //to read above JSON we need below javascript
    var obj = JSON.parse(text);
    document.getElementById("lbl1").innerHTML =
    obj.employees[1].firstName + " " + obj.employees[1].lastName;

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • Sign In to post your comments