generated from amosproj/amos202Xss0Y-projname
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#166 created a mat-icon delete component
Signed-off-by: Karol Bakas <karol.bakas@fau.de>
- Loading branch information
Showing
6 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
3 changes: 3 additions & 0 deletions
3
...entity-frontend/src/app/shared/delete-icon-clickable/delete-icon-clickable.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<button mat-icon-button (mousedown)="deleteEvent()"> | ||
<mat-icon [attr.aria-label]="'Delete item'"> delete </mat-icon> | ||
</button> |
25 changes: 25 additions & 0 deletions
25
...ity-frontend/src/app/shared/delete-icon-clickable/delete-icon-clickable.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { DeleteIconClickableComponent } from './delete-icon-clickable.component'; | ||
|
||
describe('DeleteIconClickableComponent', () => { | ||
let component: DeleteIconClickableComponent; | ||
let fixture: ComponentFixture<DeleteIconClickableComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ DeleteIconClickableComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DeleteIconClickableComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
30 changes: 30 additions & 0 deletions
30
...Identity-frontend/src/app/shared/delete-icon-clickable/delete-icon-clickable.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { | ||
animate, | ||
state, | ||
style, | ||
transition, | ||
trigger, | ||
} from '@angular/animations'; | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { BackendHttpService } from 'src/app/services/backend-http-service/backend-http-service.service'; | ||
|
||
@Component({ | ||
selector: 'app-delete-icon-clickable', | ||
templateUrl: './delete-icon-clickable.component.html', | ||
styleUrls: ['./delete-icon-clickable.component.css'], | ||
}) | ||
export class DeleteIconClickableComponent implements OnInit { | ||
@Input() id: number = -1; | ||
@Input() deleteRequest: (id: number) => void = (id: number) => { | ||
(''); | ||
}; | ||
|
||
constructor(private httpService: BackendHttpService) {} | ||
|
||
ngOnInit(): void {} | ||
|
||
deleteEvent() { | ||
console.log('Delete this item' + this.id); | ||
this.deleteRequest(this.id); | ||
} | ||
} |