Создайте шаблон ng с кнопкой редактирования ANGULAR CLI - PullRequest
0 голосов
/ 28 ноября 2018

Я хочу создать модель ng-шаблона, поэтому, если я нажму на кнопку редактирования, в шаблоне модели мне будет показано подтверждение от имени, и я смогу отредактировать его и сохранить или закрыть.Как я могу это сделать?Я импортировал бутстрап.спасибо за вашу помощь!

cohorts.component.html

<div class="container">
  <h1>Cohorts</h1>
  <div class="row">
    <div class="offset-3"></div>
    <div class="col-md-6">
      <form (ngSubmit)="addCohorte()">
        <div class="form-group">
          <label>Create new Cohorte:</label>
          <br>
          <input
            type="text"
            [(ngModel)]="data.name"
            [ngModelOptions]="{standalone: true}">
        </div>

        <button type="submit" class="btn btn-primary pull right">
          <i class="fa fa-envelope-o"></i>
          <span>Add Cohorte</span>
        </button>
      </form>
      <br>
      <table class="table table-striped table-bordered table-hover ng-scope">
        <thead>
        <tr>
          <th>Name</th>
          <th>Actions</th>
        </tr>
        </thead>
        <tbody>
        <tr *ngFor="let cohort of cohorts">
          <td>
            {{cohort.name}}
          </td>
          <td>
            <button  class="btn btn-info" type="button" (click)="save(cohort.id)">Edit</button>

            &shy;
            &shy;
            &shy;
            <button class="btn btn-danger" type="button" (click)="deleteCohorte(cohort.id)">Delete</button>
          </td>
        </tr>
        <!-- ngRepeat: cohort in vm.entities | orderBy:'name':false -->
        </tbody>
      </table>
    </div>
  </div>
</div>
...