because href=“#” not direct me to the right page的问题

问题描述 投票:0回答:1

问题

问题是基于html代码部分的第三行。

当我点击我的编辑按钮/图标时,我会转到我的头版。因为http:// localhost:xxxx /而不是http://localhost:xxxx/note,我讨论它。我曾尝试过例如href = / note /#但是它只是重新加载注释页面而不是打开辅助内容。

http://localhost:xxxx/note的Html代码:

 <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>

html collections materialize
1个回答
0
投票

在URL中使用somedomain.com/some/path/page#domId使浏览器向下滚动到元素<someelement id=domId>。这通常用于在具有长内容的页面上制作滚动锚点。看起来你错过了它。我不确定为什么它会为你“打开任何东西”

© www.soinside.com 2019 - 2024. All rights reserved.