Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tutorial] What is Angular Routing? #282

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d00340e
Code for angular application with multiple routes
ShambhaviVijay Mar 22, 2023
b0dfc4d
Instructions to run Angular app on localhost
ShambhaviVijay Mar 22, 2023
34f6c85
Update readme.md
ShambhaviVijay Mar 22, 2023
aabecdf
Update readme.md
ShambhaviVijay Mar 22, 2023
56a4159
Added the details of What is Angular Routing And How to se it
Sandyah06 Mar 23, 2023
0901a0e
Merge pull request #1 from Sandyah06/patch-1
ShambhaviVijay Mar 23, 2023
d619041
Data passing in Angular basics added in readme.md
smohith79 Mar 23, 2023
18ff451
How to Pass data between angular routes.
Shailaja0205 Mar 23, 2023
0d9a330
Merge pull request #3 from Shailaja0205/patch-2
ShambhaviVijay Mar 23, 2023
264a8ec
Merge pull request #2 from smohith79/patch-1
ShambhaviVijay Mar 23, 2023
b93525e
Update readme.md
ShambhaviVijay Mar 23, 2023
2fc5896
Data passing contents added.
estherjoanna30 Mar 23, 2023
db278bb
Merge pull request #4 from estherjoanna30/patch-1
ShambhaviVijay Mar 23, 2023
9408b39
Angular definition added in readme file.
Martin-20122001 Mar 23, 2023
5d9c89e
Merge pull request #5 from Martin-20122001/patch-1
ShambhaviVijay Mar 23, 2023
cdcb45f
changes done.
ShambhaviVijay Mar 24, 2023
ff94e62
complete
ShambhaviVijay Mar 24, 2023
ca5dc8f
Update readme.md
ShambhaviVijay Mar 24, 2023
294776f
Readme content added.
ShambhaviVijay Mar 24, 2023
57c3ac0
restored
ShambhaviVijay Mar 24, 2023
b080820
changes done
ShambhaviVijay Mar 24, 2023
b5cfb7c
Update README.md
ShambhaviVijay Mar 24, 2023
993ff5b
Update README.md
ShambhaviVijay Mar 24, 2023
4176df0
Update README.md
ShambhaviVijay Mar 24, 2023
6b37703
Update README.md
ShambhaviVijay Mar 24, 2023
14f4aef
Edits done.
ShambhaviVijay Mar 24, 2023
c606023
Update README.md
ShambhaviVijay Mar 24, 2023
5e3a0ed
Update README.md
ShambhaviVijay Mar 24, 2023
11ef2cb
Merge branch 'master' of github.com:ShambhaviVijay/documentationSODA
ShambhaviVijay Mar 24, 2023
ec2a076
Required changes done.
ShambhaviVijay Mar 28, 2023
5d310c7
Update README.md
ShambhaviVijay Mar 28, 2023
cff9708
Update README.md
ShambhaviVijay Mar 28, 2023
5b8bd3d
Update README.md
ShambhaviVijay Mar 28, 2023
8848604
Update README.md
ShambhaviVijay Mar 28, 2023
b06ff95
Update README.md
ShambhaviVijay Mar 28, 2023
b3e5619
msg
Deepikavk00 Mar 31, 2023
9d554ab
Merge pull request #6 from ASHAE847/master
ShambhaviVijay Apr 3, 2023
9700c18
Delete rmu.txt
ShambhaviVijay Apr 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions learning/dashboard/angular_routing/my-app/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
42 changes: 42 additions & 0 deletions learning/dashboard/angular_routing/my-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": ["angular.ng-template"]
}
20 changes: 20 additions & 0 deletions learning/dashboard/angular_routing/my-app/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ng serve",
"type": "pwa-chrome",
"request": "launch",
"preLaunchTask": "npm: start",
"url": "http://localhost:4200/"
},
{
"name": "ng test",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: test",
"url": "http://localhost:9876/debug.html"
}
]
}
42 changes: 42 additions & 0 deletions learning/dashboard/angular_routing/my-app/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
},
{
"type": "npm",
"script": "test",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
}
]
}
27 changes: 27 additions & 0 deletions learning/dashboard/angular_routing/my-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# MyApp

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.2.4.

## Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.

## Code scaffolding

Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.

## Running unit tests

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
102 changes: 102 additions & 0 deletions learning/dashboard/angular_routing/my-app/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"my-app": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/my-app",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "my-app:build:production"
},
"development": {
"browserTarget": "my-app:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "my-app:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
}
}
}
}
},
"cli": {
"analytics": "b59b31a0-cff1-427a-99e0-69783de84417"
}
}
45 changes: 45 additions & 0 deletions learning/dashboard/angular_routing/my-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "my-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^15.2.0",
"@angular/common": "^15.2.0",
"@angular/compiler": "^15.2.0",
"@angular/core": "^15.2.0",
"@angular/forms": "^15.2.0",
"@angular/platform-browser": "^15.2.0",
"@angular/platform-browser-dynamic": "^15.2.0",
"@angular/router": "^15.2.0",
"@fortawesome/angular-fontawesome": "^0.12.1",
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-solid-svg-icons": "^6.2.1",
"@ng-bootstrap/ng-bootstrap": "^14.0.1",
"@popperjs/core": "^2.11.6",
"bootstrap": "^5.2.3",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.12.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^15.2.4",
"@angular/cli": "~15.2.4",
"@angular/compiler-cli": "^15.2.0",
"@angular/localize": "^15.2.0",
"@types/jasmine": "~4.3.0",
"jasmine-core": "~4.5.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"typescript": "~4.9.4"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { LoginComponent } from './components/login/login.component';
import { ForgetPasswordComponent } from './components/forget-password/forget-password.component';
import { NotFoundComponent } from './components/not-found/not-found.component';


const routes: Routes = [
{path: 'login', component: LoginComponent },
{path: 'forget-password', component: ForgetPasswordComponent },
{path: '' , redirectTo : '/login', pathMatch: 'full'},
// LAZY LOADING

{path:'admin',
loadChildren: ()=>
import('./modules/admin/admin.module').then((m) => m.AdminModule),
},
{path: '**', component: NotFoundComponent }];

@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }

Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@


<router-outlet></router-outlet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';

describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
});

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});

it(`should have as title 'my-app'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('my-app');
});

it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('my-app app is running!');
});
});
10 changes: 10 additions & 0 deletions learning/dashboard/angular_routing/my-app/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'my-app';
}
Loading