Aurelia select不起作用
我有以下问题。 我试图通过读取json文件来填充一个简单的select,而不是在select中显示任何对象的标题作为选项。 当我尝试在div元素中显示标题时,代码工作得很好,但不是作为select。 这是我的密码:Aurelia select不起作用,select,aurelia,Select,Aurelia,我有以下问题。 我试图通过读取json文件来填充一个简单的select,而不是在select中显示任何对象的标题作为选项。 当我尝试在div元素中显示标题时,代码工作得很好,但不是作为select。 这是我的密码: import {inject} from 'aurelia-framework'; import {HttpClient} from 'aurelia-http-client'; @inject(HttpClient) export class Select{ title = "T
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>
尝试安装最新的skelly,即0.13.0。写同样的代码,它应该会工作
确保从js文件导出的model viewmodel的名称与模板html文件的名称匹配。请详细说明您的答案,并添加一点关于您提供的解决方案的说明。在有疑问的代码中,问题在于导出类的名称及其相对模板