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