Explorar el Código

Instantiate Student & Teacher Components, Implement Routing

Eldar Mukhtarov hace 9 meses
padre
commit
1f193000e8

+ 7 - 0
project/frontend-angular/src/app/app.html

@@ -227,6 +227,13 @@
       </svg>
       <h1>Hello, {{ title }}</h1>
       <p>Congratulations! Your app is running. 🎉</p>
+      <app-student></app-student>
+      <app-teacher></app-teacher>
+      <h1>Navigation</h1>
+      <a routerLink="student">Student</a>
+      <br>
+      <a routerLink="teacher">Teacher</a>
+      <br>
     </div>
     <div class="divider" role="separator" aria-label="Divider"></div>
     <div class="right-side">

+ 6 - 1
project/frontend-angular/src/app/app.routes.ts

@@ -1,3 +1,8 @@
 import { Routes } from '@angular/router';
+import { Student } from './student/student';
+import { Teacher } from './teacher/teacher';
 
-export const routes: Routes = [];
+export const routes: Routes = [
+    { path: 'student', component: Student },
+    { path: 'teacher', component: Teacher }
+];

+ 4 - 2
project/frontend-angular/src/app/app.ts

@@ -1,9 +1,11 @@
 import { Component } from '@angular/core';
-import { RouterOutlet } from '@angular/router';
+import { RouterLink, RouterOutlet } from '@angular/router';
+import {Student} from './student/student';
+import {Teacher} from './teacher/teacher';
 
 @Component({
   selector: 'app-root',
-  imports: [RouterOutlet],
+  imports: [RouterOutlet, Student, RouterLink, Teacher],
   templateUrl: './app.html',
   styleUrl: './app.css'
 })

+ 0 - 0
project/frontend-angular/src/app/student/student.css


+ 1 - 0
project/frontend-angular/src/app/student/student.html

@@ -0,0 +1 @@
+<p>student works!</p>

+ 23 - 0
project/frontend-angular/src/app/student/student.spec.ts

@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { Student } from './student';
+
+describe('Student', () => {
+  let component: Student;
+  let fixture: ComponentFixture<Student>;
+
+  beforeEach(async () => {
+    await TestBed.configureTestingModule({
+      imports: [Student]
+    })
+    .compileComponents();
+
+    fixture = TestBed.createComponent(Student);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 11 - 0
project/frontend-angular/src/app/student/student.ts

@@ -0,0 +1,11 @@
+import { Component } from '@angular/core';
+
+@Component({
+  selector: 'app-student',
+  imports: [],
+  templateUrl: './student.html',
+  styleUrl: './student.css'
+})
+export class Student {
+
+}

+ 0 - 0
project/frontend-angular/src/app/teacher/teacher.css


+ 1 - 0
project/frontend-angular/src/app/teacher/teacher.html

@@ -0,0 +1 @@
+<p>teacher works!</p>

+ 23 - 0
project/frontend-angular/src/app/teacher/teacher.spec.ts

@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { Teacher } from './teacher';
+
+describe('Teacher', () => {
+  let component: Teacher;
+  let fixture: ComponentFixture<Teacher>;
+
+  beforeEach(async () => {
+    await TestBed.configureTestingModule({
+      imports: [Teacher]
+    })
+    .compileComponents();
+
+    fixture = TestBed.createComponent(Teacher);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 11 - 0
project/frontend-angular/src/app/teacher/teacher.ts

@@ -0,0 +1,11 @@
+import { Component } from '@angular/core';
+
+@Component({
+  selector: 'app-teacher',
+  imports: [],
+  templateUrl: './teacher.html',
+  styleUrl: './teacher.css'
+})
+export class Teacher {
+
+}