aftab
aftab

Reputation: 545

How to retrieve data for angularjs expression from json?

I have a json response i want to populate data into fields how i can achieve that task using angularjs expression.how i would map values from json response to html page.

so far i tried this...

HTML

<div class="row">
    <div class="col-md-6">
        <label class="control-label">Rule Id</label>
        <div>{{ruleIdentifier}}</div>
    </div>
    <div class="col-md-6">
        <label class="control-label">SubpartID</label>
        <div>{{subpartId}}</div>
    </div>
</div>

MODALCTRL.JS

lrrDetails.findlrrDetail().then(function(response){
  $scope.lrrDetail = response;
  $scope.ruleidentifier = $scope.lrrDetail.id
})

FACTORY.JS

findlrrDetail: function(result){
        return $http.get('/third-party-management/rest/lrr/17181');
        $scope.lrrDetail = result.data;
    },

JSON.JS

    {"id":1,
"sourceFeedKey":15,
"lookupCode":"RS_DELETED",
"externalIndintifier":"47",
"subpartCitationIndicator":"1",
"ruleIdentifier":"13",
"ruleSubpartExternalIdentifier":"55029",
"subpartCount":null,
"subpartCitationCount":null,
"citationValue":"18 U.S.C. 2711",
"ruleName":"Definitions For Chapter",
"highValueSummary":"This chapter provides guidance on stored wire and electronic communications and transactional records access and contains provisions of the Stored Communications 
Act.","
issuingAuthKey":873,
"citationAsOfDate":1325566800000,
"vedourActivityType":"Internal Activity",
"vedourActivityDescription1":null,
"vedourActivityDescription2":null,
"applicabilityIndicator":"0",
"auditGroupCategory":null,
"auditGroupIndicator":null,
"citationCoreIndicator":null,
"createdDate":1352497145890,
"modifiedDate":1375313477250,
"createdBy":"ERDSYSTEM",
"mofifiedBy":"NBKQNXS",
"regulatoryInventoryName"

Upvotes: 1

Views: 653

Answers (1)

Reza
Reza

Reputation: 1546

Here is an example of how to work with $http and how to populate the data. Hopefully it works for you. http://jsfiddle.net/8qumcq80/1/

Upvotes: 1

Related Questions