Asked By: Anonymous
I have the following problem.
I’m trying to fill a simple select by reading a json file and than displaying the title of any object as an option inside the select.
The code works just fine when i try to display the titles inside div elements, but not as select.
Here is my code:
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;
});
}
}
and 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>
Solution
Answered By: Anonymous
Try installing latest skelly https://github.com/aurelia/skeleton-navigation/releases which is 0.13.0. Write same code and it should work.
Make sure that the name of the model (viewmodel) which you export from your js file matches the name of the template (html) file.