add default 404 page

This commit is contained in:
Peter Maquiran
2023-12-06 13:14:41 +01:00
17 changed files with 411 additions and 476 deletions
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { NotFoundPage } from './not-found.page';
const routes: Routes = [
{
path: '',
component: NotFoundPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class NotFoundPageRoutingModule {}
@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { NotFoundPageRoutingModule } from './not-found-routing.module';
import { NotFoundPage } from './not-found.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
NotFoundPageRoutingModule
],
declarations: [NotFoundPage]
})
export class NotFoundPageModule {}
@@ -0,0 +1,9 @@
<ion-content class="d-flex justity-center align-center">
<div class="ion-justify-content-center justify-content-center align-center d-flex height-100 width-100">
<h4>
A Reencaminhar a página
</h4>
</div>
</ion-content>
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { NotFoundPage } from './not-found.page';
describe('NotFoundPage', () => {
let component: NotFoundPage;
let fixture: ComponentFixture<NotFoundPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ NotFoundPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(NotFoundPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
+22
View File
@@ -0,0 +1,22 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { ToastService } from 'src/app/services/toast.service';
@Component({
selector: 'app-not-found',
templateUrl: './not-found.page.html',
styleUrls: ['./not-found.page.scss'],
})
export class NotFoundPage implements OnInit {
constructor(
private router: Router,
private toastService: ToastService,
) { }
ngOnInit() {
this.router.navigate(['/home/events']);
this.toastService._badRequest("Página não encontrada. Contacte o suporte técnico")
}
}