0

I am trying to initialize a list of item using ng-repeat.

<div class="item" ng-click="selectedProject(fpItem)" data-id="{{fpProjectItem.id}}" ng-repeat="fpItem in fpItems">
   <img src="{{fpItem.thumbnail}}" />
    <span class="item-title">{{fpItemDetails.projectname}}</span>
</div>

It gives an error

.../location/fpItem.thumbnail%7D%7D net::ERR_FILE_NOT_FOUND

How to resolve this.

Also I want to initialize default selected value. How can i do.

user1853803
  • 649
  • 3
  • 8
  • 27
  • you're asking two questions here: first your file is not found so the file `$scope.fpItems` is trying to load is not the correct path. second, set one of the values to the `ng-model` – user2954587 Mar 19 '16 at 04:45
  • possible duplicate of http://stackoverflow.com/questions/12922509/image-get-requests-with-angularjs – bob Mar 19 '16 at 05:43

2 Answers2

1

Use ng-src for your image. See: https://docs.angularjs.org/api/ng/directive/ngSrc

For determining the first item in the ng-repeat use $first, or $index === 0.

For example add the ang attribute ng-class="{'selected':$first}"

iambriansreed
  • 21,935
  • 6
  • 63
  • 79
0

Try replacing in your code to . with src the path is not resolved.