ionic-denizhan-fixed-module
v1.0.1
Published
Custom Login&Register pages with feature of saving access-token to the local storage.
Downloads
4
Readme
Custom Home & Login & Register Pages
This is a custom ionic module made by Denizhan Aras. This module includes custom Home, Login and Register pages with feature of saving access-token response from portalium auth module to the local storage. There are Guard and Auth services provided with the support of checking login status of the user.
Installing the package
- Navigate to your ionic app's folder.
- Use npm i ionic-denizhan-fixed-module command to install package.
Using Home,Login and Register Pages in your app
--> app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
//required to route app to our custom components using app-routing.module.
import { HttpClientModule } from '@angular/common/http';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
// Add HttpClientModule to imports.
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, HttpClientModule],
providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
bootstrap: [AppComponent],
})
export class AppModule {}
--> app-routing.module.ts
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
//import our custom modules from 'ionic-denizhan-fixed-module'.
import { HomePage, LoginPage, RegisterPage } from 'ionic-denizhan-fixed-module';
//Add custom modules to route with appropriate paths.
const routes: Routes = [
{
path: 'home',
component: HomePage
},
{
path: 'login',
component: LoginPage
},
{
path: 'register',
component: RegisterPage
}
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }
--> app.component.html
// Add your welcome page design.
// Don't forget to add routerLink and router-outlet for navigation.
<h1 class="center">Welcome!</h1>
<nav class="center">
<a routerLink="home">Homepage</a>
</nav>
<router-outlet></router-outlet>
Run app!
- Run the app by using ionic serve command.
- "app.component.html" should appear.
- You can navigate to custom Homepage according to your -app.component.html design.
- There, you can select Login or Register buttons.