Проблема с <a href="#" class="secondary-content">, потому что href = "#" не направляет меня на нужную страницу - PullRequest
0 голосов
/ 09 сентября 2018

Проблема

Проблема основана на третьей строке в разделе HTML-кода.

Когда я нажимаю кнопку / иконку редактирования, я перехожу на первую страницу.Я отказался от этого из-за http://localhost:xxxx/, а не http://localhost:xxxx/note.. Я пробовал, например, href = / note / #, но затем он просто перезагрузил страницу заметок и не открыл вторичный контент.

HTML-код для http://localhost:xxxx/note:

 <div *ngIf="notes?.length > 0;else noNotes">
<ul *ngFor="let note of notes" class="collection">
  <li class="collection-item"><strong>{{note.title}}: </strong> {{note.description}} <a href="#" class="secondary-content">
    <i (click)="editNote($event, note)" class="fa fa-pencil"></i>  
    <i *ngIf="editState && noteToEdit.id == note.id" (click)="clearState()" class="fa fa-compress"></i>  
  </a>

  <div *ngIf="editState && noteToEdit.id == note.id">
    <form (ngSubmit)="updateNote(note)">
        <div class="row">
            <div class="input-field col s6">
              <input type="text" placeholder="Add Title" [(ngModel)]="note.title" name="title">
            </div>
            <div class="input-field col s6">
              <input type="text" placeholder="Add Description" [(ngModel)]="note.description" name="description">
            </div>
            <input type="submit" value="Update Note" class="btn orange">
            <button (click)="deleteNote($event, note)" class="btn red">Delete Item</button>
          </div>
    </form>
  </div>
  </li>
</ul>

1 Ответ

0 голосов
/ 10 сентября 2018

Использование somedomain.com/some/path/page#domId в URL позволяет браузеру прокручивать страницу до элемента <someelement id=domId>.Это обычно используется для создания якорей прокрутки на страницах с длинным содержимым.Похоже, ты упустил это.Я не уверен, почему это "откроет что-нибудь" для вас

...