如何导航到使用id属性标识的页面的某些部分?
例:
我需要导航到我页面上的"结构"段落
<div id="info">
<h3>Info</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
<div id="structure">
<h3>Structure</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
Run Code Online (Sandbox Code Playgroud)
我有一个以下导航结构:
<li>
<ul materialize="collapsible" class="collapsible" data-collapsible="accordion">
<li><a routerLink="policies" class="collapsible-header">Policies</a>
<div class="collapsible-body">
<ul>
<li><a >Info</a></li>
<li><a >Structure</a></li>
<li><a >Something Else</a></li>
</ul>
</div>
</li>
</ul>
</li>
Run Code Online (Sandbox Code Playgroud)
据我所知,在Angular1.0中,我只需使用以下内容导航到页面部分:ui-sref ="policies({'#':'structure'})"或href ="#structure"或ui -sref ="policies"href ="#structure"......
我怎么能在Angular2中做到这一点?我查看了文档中的Fragment示例:查询参数和片段部分,我发现它们的例子非常令人困惑,对于这样一个潜在的简单任务来说有点矫枉过正
Nx到底是什么?我正在为一个工作项目推销 Nx 设置,因为我看到了它的巨大价值,但我无法向我的同事解释什么是 Nx。他们问:如果我们将 Nx 添加到我们的 Angular 项目中,它会做什么?有人可以帮我简单地回答这个问题吗?
尝试计算总的payOffs.amount(payOffs是一个FormArray)。不确定如何正确执行操作,因此总计将观察到金额的当前值和新值的变化。这是我作为基本代码使用的plnkr:http ://plnkr.co/edit/nHSIsciSZNTQzQjxkXsk?p=preview
<form (ngSubmit)="onSubmit()" [formGroup]="form">
<label>Name</label>
<input type="text" formControlName="name" [(ngModel)]="myModel.name" placeholder="Name">
<p>Pay Offs</p>
<table class="simple-table">
<tr>
<th>Amount</th>
<th>Date</th>
<th>Final?</th>
<th></th>
</tr>
<tbody>
<tr *ngFor="let po of form.find('payOffs').controls; let i = index">
<td>
<input type="text" size=10 [formControl]="po.controls.amount" [(ngModel)]="myModel.payOffs[i].amount">
</td>
<td>
<input type="text" [formControl]="po.controls.date" [(ngModel)]="myModel.payOffs[i].date">
</td>
<td>
<input type="checkbox" [formControl]="po.controls.final" [(ngModel)]="myModel.payOffs[i].final">
</td>
<td>
<button (click)="deletePayOff(i)" style="color: white; background: rgba(255, 0, 0, .5)">x</button>
</td>
</tr>
</tbody>
<tr>
<td colspan="4" style="text-align: center; padding: .5em;">
<button (click)="addPayOff($event)" style="color: white; background: rgba(0, 150, 0, 1)">Add …Run Code Online (Sandbox Code Playgroud)