Skip to content

Commit

Permalink
#166 created a mat-icon delete component
Browse files Browse the repository at this point in the history
Signed-off-by: Karol Bakas <karol.bakas@fau.de>
  • Loading branch information
Idontker committed Jun 24, 2022
1 parent f5cc130 commit a1c4250
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/digitalIdentity-frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { MenuItemComponent } from './components/menu-item/menu-item.component';
import { FilteredTableComponent } from './shared/filtered-table/filtered-table.component';
import { ChangePasswordComponent } from './pages/change-password-page/change-password-page.component';
import { CredDefOverviewPageComponent } from './pages/credential/credential-overview-page/credDef-overview-page.component';
import { DeleteIconClickableComponent } from './shared/delete-icon-clickable/delete-icon-clickable.component';

@NgModule({
declarations: [
Expand All @@ -43,6 +44,7 @@ import { CredDefOverviewPageComponent } from './pages/credential/credential-over
FilteredTableComponent,
ChangePasswordComponent,
CredDefOverviewPageComponent,
DeleteIconClickableComponent,
],
imports: [
AppRoutingModule,
Expand All @@ -51,7 +53,7 @@ import { CredDefOverviewPageComponent } from './pages/credential/credential-over
FormsModule,
HttpClientModule,
MaterialModule,
ReactiveFormsModule
ReactiveFormsModule,
],
bootstrap: [AppComponent],
providers: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { MatMenuModule } from '@angular/material/menu';

import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material/core';

//module for DD/MM/YYYY date format
import { MAT_DATE_LOCALE } from '@angular/material/core';

Expand Down
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>
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();
});
});
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);
}
}

0 comments on commit a1c4250

Please sign in to comment.