1
我有一个表单,使用Material Design Lite呈现,我通过回调异步REST API调用来填充,但我在DOM中获得以下结果:异步填充后材质设计精简版表单不会呈现
如果我专注于一个文本框,它通常显示,因为不是如果我不(标题必须是在文本上)。当我查看HTML时,我看到value
属性没有显示,这可能是为什么。我填充字段是这样的:
$.ajax({
url: '/api/v1/map/config',
method: 'get',
success: function(response) {
this.xoffset = response.xoffset;
this.yoffset = response.yoffset;
this.xscaling = response.xscaling;
this.yscaling = response.yscaling;
this.path = response.path;
$("input[name=xoffset]").val(response.xoffset);
$("input[name=yoffset]").val(response.yoffset);
$("input[name=xscaling]").val(response.xscaling);
$("input[name=yscaling]").val(response.yscaling);
$(".map-preview").html("<img src='" + response.path + "' />");
componentHandler.upgradeAllRegistered();
},
error: function(err) {
err = JSON.parse(err.responseText);
if (err.error) {
SnackbarManager.pushError(err.error);
} else {
SnackbarManager.pushError("Une erreur s'est produite");
}
}
});
谢谢您的帮助
试试这个回答: http://stackoverflow.com/questions/31638890/mdl-textfield-not-taking-ngmodel-changes-into-account/40781433#40781433 – Mao