我的导航标签中有一个按钮,它是通过循环列表来呈现的
<nav *ngFor="let test of getTests(); let last = last">
<button (click)="clickFunction() ></button>
</nav>
Run Code Online (Sandbox Code Playgroud)
单元测试时如何获取按钮的点击事件?
这不起作用:
let button = fixture.debugElement.query(By.css('button'));
button.nativeElement.click();
Run Code Online (Sandbox Code Playgroud)
这给了我一个错误,说它button是空的。
angular typescriptObject和objectangular typescript 有什么区别
我收到一个 tslint 错误:
不要使用“对象”作为类型。避免使用
Object类型。你的意思是object?