1

次の問題があります。jsonファイルを読み取り、選択内のオプションとしてオブジェクトのタイトルを表示することにより、単純な選択を埋めようとしています。div 要素内にタイトルを表示しようとすると、コードは正常に機能しますが、select としては機能しません。これが私のコードです:

import {inject} from 'aurelia-framework';
import {HttpClient} from 'aurelia-http-client';

@inject(HttpClient)
export class Select{
title = "Title";
images = [];
url = 'http://api.flickr.com/services/feeds/photos_public.gne?tags=rainier&tagmode=any&format=json';
favImage = '';

constructor(http) {
    this.http = http;
}

activate() {
    return this.http.jsonp(this.url).then(response => {
        this.images = response.content.items;
    });

}

}

と HTML

<template>
<div>${title}</div> 
<div repeat.for="pic of images">${pic.title}</div> //This works just fine
<select value.bind="favImage"> //This doesn't work
    <option>Select Picture</option>
    <option repeat.for="pic of images" model.bind="pic">${pic.title}</option>
</select>

4

1 に答える 1