I don't think you mean to have $routeParams.itemId wrapped in single quotes.  
I'm pretty sure that property doesn't exist in the response.  Assign the value 
to the scope's property.

Raul

Sent from my iPhone

> On Aug 11, 2014, at 3:56 PM, Steve Husting <[email protected]> wrote:
> 
> I don't know what you mean by "in scope." :) I've tried that syntax earlier 
> and it did not show, so I tried concatenation. 
> 
> Here's my sample data.json file:
> 
> [
>     {
>     "model" : "Calla Lily",
>     "description" : "Amethyst Riches",
>     "shortname" : "calla"
>     },
>     {
>     "model" : "Rose",
>     "description" : "Red Rose Bouquet",
>     "shortname" : "rose"
>     },
>     {
>     "model" : "Orchid",
>     "description" : "Tickled Pink Orchid",
>     "shortname" : "orchid"
>     },
>     {
>     "model" : "Gerbera Daisy",
>     "description" : "Colorful World Gerbera Daisy",
>     "shortname" : "daisy"
>     }
> ]
> 
> My controllers3.js file refers to it:
> 
> var artistControllers = angular.module('artistControllers', []); 
> 
> // Controllers have their first letter capitalized: ListController 
> artistControllers.controller('ListController', ['$scope', '$http', 
> function($scope, $http) { 
>     $http.get('js/data.json').success(function(data) {
>         $scope.flowers = data;
>         $scope.flowerSort = 'model';
>     });
> }]);
> 
> artistControllers.controller('DetailsController', ['$scope', '$http', 
> '$routeParams', function($scope, $http, $routeParams) { 
>     $http.get('js/data.json').success(function(data) {
>         $scope.flowers = data;
>         $scope.whichItem = '$routeParams.itemId'; 
>     });
> }]);
> 
> My detail.html file displays the data like this:
> 
> <section>
>     <div ng-model="flowers">
>         <h2>Flower: {{flowers[whichItem].model}}</h2>
>         <img ng-src="images/{{flowers[whichItem].shortname}}.jpg" 
> width="120px" alt="Photo of {{flowers[whichItem].model}}">
>         <p>This lovely arrangement, "{{flowers[whichItem].description}}," 
> will be sure to please any recipient.</p>
>     </div>
>     <a href="index3.html">&laquo; Back to flower listing</a>
> </section>
> 
> 
>> On Friday, August 8, 2014 2:17:50 PM UTC-7, Raul Vieira wrote:
>> It should be straight forward:
>> 
>> <img alt=“{{item.shortname}}” title=“{{item.shortname}}” src=“somwhere" />
>> 
>> Are you sure item is on the scope?  Also, you’re example looks busted:   
>> title=" Photo " + {{item.shortname}}  should be title=“Photo 
>> {{item.shortname}}"
>> 
>> Raul
>> 
>>> On Aug 8, 2014, at 12:29 PM, Steve Husting <[email protected]> wrote:
>>> 
>>> Since this is going to be a mobile application, the alt and title tags are 
>>> not relevant. But I would assume they will be used on a desktop site. 
>>> 
>>>> On Friday, August 8, 2014 8:11:30 AM UTC-7, Steve Husting wrote:
>>>> No, those aren't listed in the API at https://docs.angularjs.org/api so 
>>>> they didn't work for me. Thanks for the idea!
>>>> 
>>>>> On Thursday, August 7, 2014 10:49:40 PM UTC-7, Darshan Joshi wrote:
>>>>> Hi,
>>>>> 
>>>>> Try to use data-ng-alt and data-ng-title. Of-course you can use same 
>>>>> without data- prefix.
>>>>> 
>>>>> 
>>>>>> On Friday, August 8, 2014 3:45:06 AM UTC+5:30, Steve Husting wrote:
>>>>>> As can be seen by the screen grab of one line of code, I'm trying to 
>>>>>> correctly format an <img's alt="Photo of {{item.shortname}}"> and 
>>>>>> title=" Photo " + {{item.shortname}}, but with no success -- "Photo of" 
>>>>>> shows up but no item.shortname. The data pulls correctly from data.json 
>>>>>> with <img ng-src="images/{{tem.shortname}}.jpg"
>>>>>> 
>>>>>> What is the correct syntax to use to make the {{item.shortname}} work 
>>>>>> for alt and title tags?
>>> 
>>> 
>>> -- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "AngularJS" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/angular.
>>> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to