javascript - Get the first value from json -
i trying first value ("source") of json file
{ "slides": [{ "source": "images/carousel-01.jpg", "title": "slide 1 title", "caption": "slide 1 description" }, { "source": "images/carousel-02.jpg", "title": "slide 2 title", "caption": "slide 2 description" }] }
i trying value angular using code
<div ng-repeat="img in slides"> <img ng-src="{{img.slides[0].source}}" /> </div>
but show me field empty not know how first or last one. not if possible, im trying create carousel.
if need first image don't need ng-repeat
try this
<img ng-src="{{slides[0].source}}" />
Comments
Post a Comment