I am trying to learn AngularJS, and after watching a video on Lynda.com I have an issue I cannot figure out. When I add an image using the ng-src the way the video instructed, and also how the angularjs site instructs, the code doubles.
HTML:
<section class="memberInfo">
<div ng-model="members">
<h1>{{members[whichItem].name}}</h1>
<img ng-src="images/faces/{{members[whichItem].shortname}}.png" alt="Photo of {{members[whichItem].name}}" />
<div class="info">
<h2>{{members[whichItem].jobtitle}}</h2>
<p>{{members[whichItem].bio}}</p>
</div>
</div>
<a href="index.html">« Back</a>
controller.js
var memberControllers = angular.module('memberControllers', []);
memberControllers.controller('TeamController', ['$scope', '$http', function ($scope, $http) {
$http.get('js/data.json').success(function(data) {
$scope.members = data;
});
}]);
memberControllers.controller('DetailsController', ['$scope', '$http','$routeParams', function($scope, $http, $routeParams) {
$http.get('js/data.json').success(function(data) {
$scope.members = data;
$scope.whichItem = $routeParams.itemId;
});
}]);
What shows in the browser is this
<img ng-src="images/faces/fname_lname.png" alt="Photo of First Last" src="images/faces/fname_lname.png">
And a 404 error, with the path skipping the short name and just leaving .../images/faces/.png
What am I doing wrong here?