I want to do if the logs click I need to increase the modal max-width to 80% and other routes need to set max-width to 50%. I use the ::ng-deep because their styles come from bootstrap. therefore I need to override those. but this one is not working for me.
This is my HTML,
<mat-sidenav mode="side" opened>
<button
mat-button
class="menu-button"
routerLink="/settings"
routerLinkActive="active"
[ngClass]="{'other-button-clicked': !isLogsLinkClicked}"
(click)="otherDevice()"
>
<!-- <mat-icon></mat-icon> -->
<span>{{ "label.name.settings" | translate }}</span>
</button>
<button
mat-button
class="menu-button"
routerLink="/pin"
routerLinkActive="active"
[ngClass]="{'other-button-clicked': !isLogsLinkClicked}"
(click)="otherDevice()"
>
<!-- <mat-icon></mat-icon> -->
<span>{{ "label.name.changepin" | translate }}</span>
</button>
<button
mat-button
class="menu-button"
routerLink="/logs"
[ngClass]="{'logs-button-clicked': isLogsLinkClicked}"
(click)="syncDevice()"
routerLinkActive="active"
>
<!-- <mat-icon></mat-icon> -->
<span>{{ "label.name.logs" | translate }}</span>
</button>
<button
mat-button
class="menu-button"
routerLink="/automatic-upgrade"
routerLinkActive="active"
[ngClass]="{'other-button-clicked': !isLogsLinkClicked}"
(click)="otherDevice()"
>
<!-- <mat-icon></mat-icon> -->
<span>{{ "label.name.automaticupgrade" | translate }}</span>
</button>
<button
mat-button
class="menu-button"
routerLink="/cache"
routerLinkActive="active"
[ngClass]="{'other-button-clicked': !isLogsLinkClicked}"
(click)="otherDevice()"
>
<!-- <mat-icon></mat-icon> -->
<span>{{ "label.name.cache" | translate }}</span>
</button>
<button
mat-button
class="menu-button"
routerLink="/unit-info"
routerLinkActive="active"
[ngClass]="{'other-button-clicked': !isLogsLinkClicked}"
(click)="otherDevice()"
>
<!-- <mat-icon></mat-icon> -->
<span>{{ "label.name.unitinfo" | translate }}</span>
</button>
</mat-sidenav>
And this is my ts function,
export class QmSettingsAdminModalComponent implements OnInit {
@Input() unitId: any;
public isLogsLinkClicked = false;
constructor(
public activeModal: NgbActiveModal,
private deviceService: DeviceService,
private router: Router
) {}
ngOnInit() {}
syncDevice() {
this.isLogsLinkClicked = true;
}
otherDevice() {
this.isLogsLinkClicked = false;
}
}
This is my scss,
.other-button-clicked {
::ng-deep .modal-dialog {
max-width: 50% !important;
margin-left: auto;
margin-right: auto;
}
}
.logs-button-clicked {
::ng-deep .modal-dialog {
max-width: 80% !important;
margin-left: auto;
margin-right: auto;
}
}