如何在html输入中退出默认值

时间:2017-11-12 15:40:29

标签: html angular typescript

我有一个html表单: looks like

我希望这些价值观看起来不像这些,只是空白。

我该怎么做?

实际上代码在这里:github

1 个答案:

答案 0 :(得分:0)

您想要的空白输入...请运行并查看



<div class="container">
<h1>Add New Book</h1>
<div class="row">
  <div class="col-md-6">
    <form (ngSubmit)="saveBook()" #bookForm="ngForm">
      <div class="form-group">
        <label for="name">ISBN</label>
        <input type="text" class="form-control" [(ngModel)]="book.isbn" name="isbn" required>
      </div>
      <div class="form-group">
        <label for="name">Title</label>
        <input type="text" class="form-control" [(ngModel)]="book.title" name="title" required>
      </div>
      <div class="form-group">
        <label for="name">Author</label>
        <input type="text" class="form-control" [(ngModel)]="idA"  name="author" required>
      </div>
      <div class="form-group">
        <input type="text" class="form-control" [(ngModel)]="book.author"  name="author" required>
      </div>
      <div class="form-group">
        <label for="name">Publisher</label>
        <input type="text" class="form-control" [(ngModel)]="book.publisher" name="publisher" required>
      </div>
      <div class="form-group">
        <label for="name">Price</label>
        <input type="number" class="form-control" [(ngModel)]="book.price" name="price" required>
      </div>
      <div class="form-group">
        <button type="submit" class="btn btn-success" [disabled]="!bookForm.form.valid">Save</button>
      </div>
    </form>
  </div>
</div>
</div>
<div class="container">
  
</div>
&#13;
&#13;
&#13;