0

This is my function to fetch the array.

  $scope.getclinicofuser = function()
    {
            var dataParameter =  {
                                    "primaryEmailId":$scope.data1.email                     
                                 }

                    $http({
                    url:  "/cms/api/user/getUserClinic",
                    method: "POST",
                    headers :{'Content-Type': 'application/json','Accept': 'application/json' },
                    data: dataParameter
                    }) .success(function(response) {

                    $scope.DomainName = response;
                 console.log($scope.DomainName);
                    });
    };

});

Here is the api call response

{
    "clinicNames": [2]
        0:  {
            "clinicName": "testing"
            "DomainName": "Aman.example.com"
            "primaryEmailId": "[email protected]"
        }-
        1:  {
            "clinicName": "test-clinic"
            "DomainName": "raman.example.com"
            "primaryEmailId": "[email protected]"
        }-
        -
        "status_code": "success"
}

My html tag

<li ng-repeat="response in DomainName">{{root.clinicNames}}</li>

Now what i want to do is to display BOTH DomainName in HTML i had a hussel with HTML ng-repeat tags but still no clues what i am doing wrong

1 Answer 1

2

Try

<li ng-repeat="response in DomainName.clinicNames track by $index">{{response.DomainName}}</li>
Sign up to request clarification or add additional context in comments.

3 Comments

damn man it works...!! just tell me one thing... mujhe controller mai for each lagane ki jarurat kyu nai pari? isko ng-repeat se kaise handle kar lia?
bro ng-repeat will work same as each loop. Ye template me iterate karne ke kaam aata h.
thanks bhai... india ka naam ucha kar dia aaj tumne :D :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.