stefansixx1
stefansixx1

Reputation: 256

add data from json in non template page with angularjs

I have static page with articles and I would like to fill number of likes for each article from json with angularjs. Is that posible or do I need to load whole page as template and fill all the detail with ng-repeat?

Is there something like

$("#like id" + i).val(jsonarray[i]) 

for angularjs?

Upvotes: 0

Views: 29

Answers (1)

michelem
michelem

Reputation: 14590

Assign the array to the scope and use the interpolation {{ }} and ng-repeat in the HTML

JS Controller:

$scope.jsonarray = jsonarray;

HTML:

<div ng-repeat="value in jsonarray">{{value}}</div>

Or:

<div id="like">{{jsonarray[0]}}</div>

Upvotes: 1

Related Questions