Skip to content

Commit 2b26ed6

Browse files
committed
feat<Interview questions>
1 parent 8e3803b commit 2b26ed6

File tree

75 files changed

+4057
-121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+4057
-121
lines changed

src/app/app-routing.module.ts

+54-28
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,65 @@ import { pageMetaData } from './core/meta-data/meta-data';
44
import { DataStructureComponent } from './layout/data-structure/data-structure.component';
55
import { HomeComponent } from './layout/home/home.component';
66
import { PageNotFoundComponent } from './layout/page-not-found/page-not-found.component';
7+
import { DsaMainComponent } from './layout/dsa-main/dsa-main.component';
8+
import { InterviewQuestionComponent } from './layout/interview-question/interview-question.component';
79

810
const routes: Routes = [
911
{
10-
path: '',
11-
component: HomeComponent,
12-
data: pageMetaData.home
12+
path:'',
13+
component: DsaMainComponent,
14+
children:[
15+
{
16+
path: '',
17+
component: HomeComponent,
18+
data: pageMetaData.home
19+
},
20+
{
21+
path: 'data-structure',
22+
component: DataStructureComponent,
23+
data: pageMetaData.dataStructure
24+
},
25+
{
26+
path: 'algorithm',
27+
data: pageMetaData.algorithms,
28+
loadChildren: () =>
29+
import('./components/Algorithms/algorithms.module').then(
30+
(m) => m.AlgorithmsModule),
31+
},
32+
33+
{
34+
path:'primitive',
35+
data: pageMetaData.primitiveDataType,
36+
loadChildren: () =>
37+
import('./components/primitiveData/primitivedata.module').then(
38+
(m) => m.PrimitiveDataModule),
39+
},
40+
{
41+
path:'non-primitive',
42+
data: pageMetaData.nonPrimitiveDataType,
43+
loadChildren: () =>
44+
import('./components/NonprimitiveData/non-primitiveData.module').then(
45+
(m) => m.NonPrimitiveDataModule),
46+
},
47+
]
1348
},
1449
{
15-
path: 'data-structure',
16-
component: DataStructureComponent,
17-
data: pageMetaData.dataStructure
18-
},
19-
{
20-
path: 'algorithm',
21-
data: pageMetaData.algorithms,
22-
loadChildren: () =>
23-
import('./components/Algorithms/algorithms.module').then(
24-
(m) => m.AlgorithmsModule),
25-
},
26-
27-
{
28-
path:'primitive',
29-
data: pageMetaData.primitiveDataType,
30-
loadChildren: () =>
31-
import('./components/primitiveData/primitivedata.module').then(
32-
(m) => m.PrimitiveDataModule),
33-
},
34-
{
35-
path:'non-primitive',
36-
data: pageMetaData.nonPrimitiveDataType,
37-
loadChildren: () =>
38-
import('./components/NonprimitiveData/non-primitiveData.module').then(
39-
(m) => m.NonPrimitiveDataModule),
50+
path:'interview-questions',
51+
component: InterviewQuestionComponent,
52+
children:[
53+
{
54+
path:'angular',
55+
loadChildren: () => import('./components/Interview/angular/angular.module').then(
56+
(m) => m.AngularModule
57+
)
58+
},
59+
{
60+
path:'javascript',
61+
loadChildren: () => import('./components/Interview/javascript/javascript.module').then(
62+
(m) => m.JavascriptModule
63+
)
64+
}
65+
]
4066
},
4167
{
4268
path: '**',

src/app/app.component.css

-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +0,0 @@
1-
.margin-top{
2-
margin-top: 90px;
3-
}
4-
@media(max-width:992px){
5-
.margin-top{
6-
margin-top: 70px;
7-
}
8-
}

src/app/app.component.html

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
<div class="container">
2-
<app-navbar></app-navbar>
3-
<div class="margin-top">
4-
<app-breadcrumbs></app-breadcrumbs>
5-
<router-outlet></router-outlet>
6-
</div>
7-
</div>
8-
<app-previous-next-route></app-previous-next-route>
1+
<app-navbar></app-navbar>
2+
<router-outlet></router-outlet>
93
<app-footer></app-footer>

src/app/app.module.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import { FormsModule } from '@angular/forms';
1313
import { PageNotFoundComponent } from './layout/page-not-found/page-not-found.component';
1414
import { ServiceWorkerModule } from '@angular/service-worker';
1515
import { environment } from '../environments/environment';
16-
import { BreadcrumbsComponent } from './layout/breadcrumbs/breadcrumbs.component';
17-
import { PreviousNextRouteComponent } from './layout/previous-next-route/previous-next-route.component';
16+
import { DsaMainComponent } from './layout/dsa-main/dsa-main.component';
17+
import { InterviewQuestionComponent } from './layout/interview-question/interview-question.component';
1818

1919

2020
@NgModule({
@@ -26,8 +26,8 @@ import { PreviousNextRouteComponent } from './layout/previous-next-route/previou
2626
FooterComponent,
2727
NavbarComponent,
2828
PageNotFoundComponent,
29-
BreadcrumbsComponent,
30-
PreviousNextRouteComponent,
29+
DsaMainComponent,
30+
InterviewQuestionComponent,
3131
],
3232
imports: [
3333
FormsModule,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.question-conationer{
2+
min-height: 500px;
3+
max-height: 500px;
4+
overflow-x: hidden;
5+
overflow-y: auto;
6+
padding-right: 10px;
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<app-breadcrumbs [selectedRoute]="currentQuestion-1" [routersData]="routesData"></app-breadcrumbs>
2+
<div class="chip mb-2">
3+
{{currentQuestion}}/{{totalQuestion}}
4+
</div>
5+
<div class="question-conationer" [innerHTML]="question"></div>
6+
<app-previous-next-route [selectedRoute]="currentQuestion-1" [routersData]="routesData"></app-previous-next-route>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { AngularQuestionsComponent } from './angular-questions.component';
4+
5+
describe('AngularQuestionsComponent', () => {
6+
let component: AngularQuestionsComponent;
7+
let fixture: ComponentFixture<AngularQuestionsComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [ AngularQuestionsComponent ]
12+
})
13+
.compileComponents();
14+
});
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(AngularQuestionsComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { AfterViewChecked, AfterViewInit, Component, OnInit } from '@angular/core';
2+
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
3+
import { angularInterviewQuestion } from 'src/app/core/interview-questions/angular/angular-metadata';
4+
import { Helper } from 'src/app/helper/helper';
5+
import { HighlightService } from 'src/app/shared/services/highlight-syntax.service';
6+
7+
@Component({
8+
selector: 'app-angular-questions',
9+
templateUrl: './angular-questions.component.html',
10+
styleUrls: ['./angular-questions.component.css']
11+
})
12+
export class AngularQuestionsComponent implements OnInit, AfterViewInit, AfterViewChecked {
13+
questions = angularInterviewQuestion;
14+
slug:string = '';
15+
totalQuestion = 0;
16+
currentQuestion = 0;
17+
routesData = Helper.setAllInterviewQuestionRoute('/interview-questions/angular/', this.questions);
18+
question = this.questions[0].answer;
19+
constructor(
20+
private highLightCode: HighlightService,
21+
private route: ActivatedRoute,
22+
private router: Router,
23+
) { }
24+
25+
ngOnInit(): void {
26+
this.totalQuestion = this.questions.length;
27+
this.route.paramMap.subscribe((params: ParamMap) => {
28+
if(params.get('slug')){
29+
this.slug = params.get('slug')!
30+
}else{
31+
this.slug = this.questions[0].slug;
32+
this.router.navigate([`/interview-questions/angular/${this.slug}`]);
33+
}
34+
const index = this.questions.findIndex(question => question.slug === this.slug);
35+
if(index>-1){
36+
this.question = this.questions[index].answer
37+
this.currentQuestion = index+1;
38+
}else{
39+
this.router.navigate([`**`]);
40+
}
41+
42+
})
43+
}
44+
45+
ngAfterViewInit(): void {
46+
this.highLightCode.highlightAll();
47+
}
48+
49+
ngAfterViewChecked(): void {
50+
this.highLightCode.highlightAll();
51+
}
52+
53+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { NgModule } from '@angular/core';
2+
import { RouterModule, Routes } from '@angular/router';
3+
import { AngularQuestionsComponent } from './angular-questions/angular-questions.component';
4+
5+
const routes: Routes = [
6+
{
7+
path:'', component: AngularQuestionsComponent
8+
},
9+
{
10+
path:':slug', component: AngularQuestionsComponent
11+
}
12+
];
13+
14+
@NgModule({
15+
imports: [RouterModule.forChild(routes)],
16+
exports: [RouterModule]
17+
})
18+
export class AngularRoutingModule { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { NgModule } from '@angular/core';
2+
import { CommonModule } from '@angular/common';
3+
4+
import { AngularRoutingModule } from './angular-routing.module';
5+
import { AngularQuestionsComponent } from './angular-questions/angular-questions.component';
6+
import { SharedModule } from 'src/app/shared/components/shared.module';
7+
8+
9+
@NgModule({
10+
declarations: [
11+
AngularQuestionsComponent
12+
],
13+
imports: [
14+
CommonModule,
15+
AngularRoutingModule,
16+
SharedModule
17+
]
18+
})
19+
export class AngularModule { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule } from '@angular/core';
2+
import { RouterModule, Routes } from '@angular/router';
3+
4+
const routes: Routes = [];
5+
6+
@NgModule({
7+
imports: [RouterModule.forChild(routes)],
8+
exports: [RouterModule]
9+
})
10+
export class CssRoutingModule { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { NgModule } from '@angular/core';
2+
import { CommonModule } from '@angular/common';
3+
4+
import { CssRoutingModule } from './css-routing.module';
5+
6+
7+
@NgModule({
8+
declarations: [],
9+
imports: [
10+
CommonModule,
11+
CssRoutingModule
12+
]
13+
})
14+
export class CssModule { }

src/app/components/Interview/html5/html5-questions/html5-questions.component.css

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p>html5-questions works!</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { Html5QuestionsComponent } from './html5-questions.component';
4+
5+
describe('Html5QuestionsComponent', () => {
6+
let component: Html5QuestionsComponent;
7+
let fixture: ComponentFixture<Html5QuestionsComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [ Html5QuestionsComponent ]
12+
})
13+
.compileComponents();
14+
});
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(Html5QuestionsComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Component, OnInit } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-html5-questions',
5+
templateUrl: './html5-questions.component.html',
6+
styleUrls: ['./html5-questions.component.css']
7+
})
8+
export class Html5QuestionsComponent implements OnInit {
9+
10+
constructor() { }
11+
12+
ngOnInit(): void {
13+
}
14+
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule } from '@angular/core';
2+
import { RouterModule, Routes } from '@angular/router';
3+
4+
const routes: Routes = [];
5+
6+
@NgModule({
7+
imports: [RouterModule.forChild(routes)],
8+
exports: [RouterModule]
9+
})
10+
export class Html5RoutingModule { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { NgModule } from '@angular/core';
2+
import { CommonModule } from '@angular/common';
3+
4+
import { Html5RoutingModule } from './html5-routing.module';
5+
import { Html5QuestionsComponent } from './html5-questions/html5-questions.component';
6+
7+
8+
@NgModule({
9+
declarations: [
10+
Html5QuestionsComponent
11+
],
12+
imports: [
13+
CommonModule,
14+
Html5RoutingModule
15+
]
16+
})
17+
export class Html5Module { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.question-conationer{
2+
min-height: 500px;
3+
max-height: 500px;
4+
overflow-x: hidden;
5+
overflow-y: auto;
6+
padding-right: 10px;
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<app-breadcrumbs [selectedRoute]="currentQuestion-1" [routersData]="routesData"></app-breadcrumbs>
2+
<div class="chip mb-2">
3+
{{currentQuestion}}/{{totalQuestion}}
4+
</div>
5+
<div class="question-conationer" [innerHTML]="question"></div>
6+
<app-previous-next-route [selectedRoute]="currentQuestion-1" [routersData]="routesData"></app-previous-next-route>

0 commit comments

Comments
 (0)