웹 UI를 사용하여 관찰 가능한 데이터 바인딩을 수행하고 있습니다. 여기에 코드의 간단한 조각은 내가 함께 일하고 있어요된다 index.html을에서toObservable이 작동하지 않는 것 같습니다.
import 'dart:html';
import 'dart:json';
import 'package:web_ui/web_ui.dart';
import 'package:admin_front_end/admin_front_end.dart';
//var properties = toObservable(new List<Property>()..add(new Property(1, new Address('','','','','',''))));
var properties = toObservable(new List<Property>());
void main() {
HttpRequest.request('http://localhost:26780/api/properties', requestHeaders: {'Accept' : 'application/json'})
.then((HttpRequest req){
final jsonObjects = parse(req.responseText);
for(final obj in jsonObjects){
properties.add(new Property.fromJsonObject(obj));
}
});
}
, 내가 템플릿에서의 각각의 속성에 properties
바인딩 :
<div is="x-property-table" id="property_table" properties="{{properties}}"></div>
, 나는 관찰 할 수있는 properties
목록을 채우고 있지만 UI에는 반영되지 않습니다. (코드를 밟아서 요소가 실제로 추가되었는지 확인했습니다). 목록을 미리 채우면 (주석 처리 된 행 참조) 바인딩이 제대로 작동하기 때문에 표시됩니다. 내가 여기서 뭔가 잘못하고있는거야?
그 트릭을했습니다. 고마워. –