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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -