У меня странная проблема с моим приложением angular5, я пытаюсь сделать простую форму отправки
ц
export class NewFormComponent implements OnInit {
formSlug:'';
newForm = {
title:"",
description:" ",
allowMultiSubmit:""
}
//create new form
createForms() {
this.formsSandbox.createNewFormPartial(newForm).subscribe((result: any) => {
console.log('created');
});
}
}
HTML
<div class="new_form_wrap_body">
<div class="new_form_content">
<div class="new_form_content_row">
<input type="text" placeholder="Title" class="new_form_input" [(ngModel)]="newForm.title">
</div>
<div class="new_form_content_row">
<textarea class="new_form_textarea" [(ngModel)]="newForm.description" maxlength="250" placeholder="Description"></textarea>
</div>
<div class="new_form_content_row">
<div class="checkbox">
<label>
<div class="check_outer">
<input name="" type="checkbox" [(ngModel)]="newForm.allowMultiSubmit">
<div class="check" for="1_in"></div>
</div>
</label>
<span>Allow multiple submission</span>
</div>
</div>
<!-- <div class="new_form_content_row">
<input type="text" placeholder="Add Collaborators" class="new_form_short_input">
</div> -->
</div>
</div>
<div class="new_form_wrap_footer">
<ul>
<li>
<button (click)="createForms()" class="new_form_footer_next">Create</button>
Это отлично работает в разработке. Когда я отправил это на сервер тестирования, который обслуживался под Apache (папка dist загружена), ngModel
не обновляет значения на newForm
при первом щелчке (триггер createForms()
). При втором щелчке newForm
обновляется с помощью значение формы
Кто-нибудь знает, почему это происходит ??