In my Angular 7 project, I am utilizing PrimeNG Calendar and I am looking to disable the month navigator at the component level based on certain conditions. For example, if the current month is February, I want to disable the month navigator after March.
https://i.sstatic.net/RhlS9.png
By using :host and ::ng-deep, I am able to override PrimeNG styles in the CSS file.
:host ::ng-deep .ui-datepicker .ui-datepicker-header .ui-datepicker-next{
display:none;
}
However, I want to apply these style changes within the component itself. I tried the following code, but it did not work as expected.
let datePickerNext = document.querySelectorAll('.ui-datepicker .ui-datepicker-header .ui-datepicker-prev');
datePickerNext.forEach(element => {
element.setAttribute("style", " margin-top: 0.6em;opacity: 0.2;");
});
Does anyone have any suggestions on how to achieve this?