Skip to content

Commit

Permalink
feat(app): usecase for repeated query param
Browse files Browse the repository at this point in the history
  • Loading branch information
udayvunnam committed Jul 19, 2020
1 parent a3ccc32 commit b364d02
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="navbar mat-elevation-z6">
<nav class="navbar-header">
<a mat-button [routerLink]="['/']" class="home">TechUnroll</a>
<a mat-button [routerLink]="['/mentor']" [queryParams]="{ viaNav: 'true' }" fxHide.lt-md="true">Mentors</a>
<a mat-button [routerLink]="['/mentor']" [queryParams]="{ viaNav: 'true', type: 'list' }" fxHide.lt-md="true">Mentors</a>
<a mat-button [routerLink]="['/mentee']" [queryParams]="{ viaNav: 'true' }" fxHide.lt-md="true">Mentees</a>
<a mat-button [routerLink]="['/connect']" [queryParams]="{ viaNav: 'true', loggedIn: 'false' }" fxHide.lt-md="true">Connect</a>
<div fxFlex></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export class MenteeAddComponent implements OnInit {
allSkills = allLanguages;
filteredSkills: Observable<string[]>;

@ViewChild('skillInput', { static: true }) skillInput: ElementRef<HTMLInputElement>;
@ViewChild('auto', { static: true }) matAutocomplete: MatAutocomplete;
@ViewChild('skillInput') skillInput: ElementRef<HTMLInputElement>;
@ViewChild('auto') matAutocomplete: MatAutocomplete;

constructor(private fb: FormBuilder, private dataService: DataService, private snackBar: MatSnackBar, private router: Router) {}

Expand Down Expand Up @@ -62,7 +62,7 @@ export class MenteeAddComponent implements OnInit {
mentee.skills = this.skills;

this.dataService.addMentee(mentee).subscribe((response: any) => {
let navigationExtras: NavigationExtras = {
const navigationExtras: NavigationExtras = {
queryParams: { addedMentor: mentee.id }
};

Expand All @@ -73,7 +73,7 @@ export class MenteeAddComponent implements OnInit {
}

add(event: MatChipInputEvent): void {
if (!this.matAutocomplete.isOpen) {
if (!this.matAutocomplete?.isOpen) {
const input = event.input;
const value = event.value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export class MenteeEditComponent implements OnInit {
allSkills = allLanguages;
filteredSkills: Observable<string[]>;

@ViewChild('skillInput', { static: true }) skillInput: ElementRef<HTMLInputElement>;
@ViewChild('auto', { static: true }) matAutocomplete: MatAutocomplete;
@ViewChild('skillInput') skillInput: ElementRef<HTMLInputElement>;
@ViewChild('auto') matAutocomplete: MatAutocomplete;

constructor(
private fb: FormBuilder,
Expand Down Expand Up @@ -80,7 +80,7 @@ export class MenteeEditComponent implements OnInit {
mentee.available = this.menteeFG.value.available;
mentee.skills = this.skills;

let navigationExtras: NavigationExtras = {
const navigationExtras: NavigationExtras = {
queryParams: { editedMentee: this.menteeId }
};

Expand All @@ -92,7 +92,7 @@ export class MenteeEditComponent implements OnInit {
}

add(event: MatChipInputEvent): void {
if (!this.matAutocomplete.isOpen) {
if (!this.matAutocomplete?.isOpen) {
const input = event.input;
const value = event.value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export class MentorAddComponent implements OnInit {
allSkills = allLanguages;
filteredSkills: Observable<string[]>;

@ViewChild('skillInput', { static: true }) skillInput: ElementRef<HTMLInputElement>;
@ViewChild('auto', { static: true }) matAutocomplete: MatAutocomplete;
@ViewChild('skillInput') skillInput: ElementRef<HTMLInputElement>;
@ViewChild('auto') matAutocomplete: MatAutocomplete;

constructor(
private fb: FormBuilder,
Expand Down Expand Up @@ -70,7 +70,7 @@ export class MentorAddComponent implements OnInit {
mentor.skills = this.skills;

this.dataService.addMentor(mentor).subscribe((response: any) => {
let navigationExtras: NavigationExtras = {
const navigationExtras: NavigationExtras = {
queryParams: { addedMentor: mentor.id }
};

Expand All @@ -81,7 +81,7 @@ export class MentorAddComponent implements OnInit {
}

add(event: MatChipInputEvent): void {
if (!this.matAutocomplete.isOpen) {
if (!this.matAutocomplete?.isOpen) {
const input = event.input;
const value = event.value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class MentorDetailsComponent implements OnInit {
private dataService: DataService,
private route: ActivatedRoute,
private router: Router
) {}
) { }

ngOnInit() {
this.getMentor();
Expand All @@ -32,6 +32,6 @@ export class MentorDetailsComponent implements OnInit {
}

editMentor() {
this.router.navigate(['./edit'], { relativeTo: this.route });
this.router.navigate(['./edit'], { relativeTo: this.route, queryParams: { type: 'edit' } });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export class MentorEditComponent implements OnInit {
allSkills = allLanguages;
filteredSkills: Observable<string[]>;

@ViewChild('skillInput', { static: true }) skillInput: ElementRef<HTMLInputElement>;
@ViewChild('auto', { static: true }) matAutocomplete: MatAutocomplete;
@ViewChild('skillInput') skillInput: ElementRef<HTMLInputElement>;
@ViewChild('auto') matAutocomplete: MatAutocomplete;

constructor(
private fb: FormBuilder,
Expand Down Expand Up @@ -92,7 +92,7 @@ export class MentorEditComponent implements OnInit {
}

add(event: MatChipInputEvent): void {
if (!this.matAutocomplete.isOpen) {
if (!this.matAutocomplete?.isOpen) {
const input = event.input;
const value = event.value;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<section class="add-item">
<a mat-fab routerLink="add" color="accent" routerLink="add">
<a mat-fab routerLink="add" color="accent" routerLink="add" [queryParams]="{ type: 'add' }">
<mat-icon matTooltip="Add a Mentor">add</mat-icon>
</a>
</section>

<section fxLayout="column" fxLayoutGap="12px">
<mat-card *ngFor="let mentor of mentors" [routerLink]="[mentor.id]">
<mat-card *ngFor="let mentor of mentors" [routerLink]="[mentor.id]" [queryParams]="{ type: 'details' }">
<mat-card-header>
<div mat-card-avatar>
<mat-icon class="person">person</mat-icon>
Expand Down

0 comments on commit b364d02

Please sign in to comment.