【发布时间】:2016-11-11 07:04:21
【问题描述】:
所以我在 angular2 组件中使用了 *ngFor 来呈现用户。
<ul>
<li *ng-for="let user of users">
<input [(ng-model)]="user.name">
<button (click)="remove(user._id)">Remove</button>
<a [routerLink]="['/edit',user._id]">
<i class="fa fa-eye fa-fw"></i>
</a>
</li>
</ul>
现在在我的量角器测试中,当我单击此链接时,它不会导航到编辑组件。
所以我想做的是:
通过传递任何 user._id 导航到 editComponent,但我不知道如何将 user._id 从模板传递到量角器 e2e 测试。
下面是我的测试:
it('should redirect to edit', () => {
browser.get('/edit/'+user._id); //here I want to pass user._id which is inside *ngFor of browser
browser.waitForAngular();
});
有什么办法吗? 谢谢
【问题讨论】:
标签: javascript node.js angular typescript protractor