Category : onclick

I have a component with 2 tables: 1)favouriteProjects 2)projects Link to picture The project will be send from my .html to my ts file and will be added to an favArray. If I click on the star next time, the project will be removed from the favourite table. How can I save the checked stars ..

Read more

I am encountering a problem with a click event. I have the following html: <div class=”page-layout blank p-24″> <mat-horizontal-stepper [linear]=”true” #stepper > <mat-step [stepControl]=”firstFormGroup”> <form [formGroup]=”firstFormGroup”> <div fxLayout=”row” fxLayoutAlign=”end center”> <button type=”button” mat-raised-button (click)=”callMethodOne()” matStepperNext>NEXT</button> </div> </form> </mat-step> <mat-step > <div fxLayout=”row” fxLayoutAlign=”end center”> <button mat-raised-button matStepperPrevious>BACK</button> <button type=”button” mat-raised-button (click)=”callMethodTwo()” matStepperNext>NEXT</button> </div> </mat-step> <mat-step> ..

Read more

I have been trying for some time this, but I am not able to make it work. I have an element with a (click) method associated: <span class="item-name" (click)="onClickElement(element.id)">{{element.name}}</span> Which Navigates to another page: onClickElement( id: number){ if(id){ this.router.navigate([‘/some-url’, id]); } } This works as expected, but if the user wants to select the text ..

Read more

I have the following setup: app.component.ts prop:string = ‘foo’; test(val){ this.prop = val; } app.component.html {{prop}} <button (click)="test(‘bar’)">Test</button> <a href="#" onclick="test(‘bar’); return false;">Test2</a> Both call test() successfully, and the ‘prop’ variable changes to ‘bar’. My question is why only the first (click) event updates the view whereas the second does not? I’ve also tried using ..

Read more

I want to pass the id of a service as parameter inside the (click) function, but can’t find the syntax for that. The way I did it, it isn’t working (doesnt display the id on console.log): HTML: <div class="select"> <select id="results" > <option value=" ">Selecione</option> <option value="{{service.id}}" *ngFor="let service of servicesList" (click)="displayCards(service.id)"> {{ service.name }} ..

Read more