Skip to content

Commit 9730e64

Browse files
committed
2: add public and protected module, login and register components and add comments in code
1 parent 0e79dae commit 9730e64

24 files changed

+531
-493
lines changed

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
# angular-material-login-and-register-example
22

3-
# Most important Steps for setting up the project
3+
## How to run
4+
First run `npm i` and then `ng serve`, then you can open localhost:4200 in your Browser
45

5-
<!-- Let the Angular CLI generate the angular starter for you -->
6-
`ng new login-and-register-example`
6+
### Commands/Cli Commands that were used to generate this project
7+
With the Angular CLI we can generate Angular Scaffolds with just one specific command. e.g. generate a component, a module, or a service
78

9+
Let the Angular CLI generate the angular starter for you
10+
`ng new login-and-register-example`
11+
12+
add angular Material to your Angular app
13+
`ng add @angular/material`
14+
15+
Generate the modules Public, Private and Shared
16+
`ng g module public`
17+
`ng g module private`
18+
19+
generate proxy file to proxy/rewrite the `/api` requests
20+
create file proxy.conf.json and add the config details
21+
then add it to the angular json under projects....serve.development.proxyConfig...

angular.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"src/assets"
3232
],
3333
"styles": [
34+
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
3435
"src/styles.scss"
3536
],
3637
"scripts": []
@@ -75,7 +76,8 @@
7576
"browserTarget": "login-and-register-example:build:production"
7677
},
7778
"development": {
78-
"browserTarget": "login-and-register-example:build:development"
79+
"browserTarget": "login-and-register-example:build:development",
80+
"proxyConfig": "src/proxy.conf.json"
7981
}
8082
},
8183
"defaultConfiguration": "development"
@@ -99,6 +101,7 @@
99101
"src/assets"
100102
],
101103
"styles": [
104+
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
102105
"src/styles.scss"
103106
],
104107
"scripts": []
@@ -108,4 +111,4 @@
108111
}
109112
},
110113
"defaultProject": "login-and-register-example"
111-
}
114+
}

package-lock.json

Lines changed: 66 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
"private": true,
1212
"dependencies": {
1313
"@angular/animations": "~13.1.0",
14+
"@angular/cdk": "^13.2.2",
1415
"@angular/common": "~13.1.0",
1516
"@angular/compiler": "~13.1.0",
1617
"@angular/core": "~13.1.0",
1718
"@angular/forms": "~13.1.0",
19+
"@angular/material": "^13.2.2",
1820
"@angular/platform-browser": "~13.1.0",
1921
"@angular/platform-browser-dynamic": "~13.1.0",
2022
"@angular/router": "~13.1.0",
@@ -36,4 +38,4 @@
3638
"karma-jasmine-html-reporter": "~1.7.0",
3739
"typescript": "~4.5.2"
3840
}
39-
}
41+
}

src/app/app-routing.module.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
import { NgModule } from '@angular/core';
22
import { RouterModule, Routes } from '@angular/router';
33

4-
const routes: Routes = [];
4+
const routes: Routes = [
5+
{
6+
// Lazy Loading the public module (all children routes will be under '/public/{route from lazy loaded module}')
7+
path: 'public',
8+
loadChildren: () => import('./public/public.module').then(m => m.PublicModule)
9+
},
10+
{
11+
// Redirects all paths that are not matching to the 'public' route/path
12+
path: '**',
13+
redirectTo: 'public',
14+
pathMatch: 'full'
15+
}
16+
];
517

618
@NgModule({
719
imports: [RouterModule.forRoot(routes)],

0 commit comments

Comments
 (0)