Reputation: 763
Is it possible to disable a view component by using a class selector, in Angular 5? I don't have access to the code for the component I am trying to disable (the code is imported during npm install, a shared component with other teams, it's a header bar, and I'd like to disable a feature in that component). I think with jquery you could do something like: $('.my-custom-drop-down').disable(). I'd like to do something similar in Angular. Thanks!
Upvotes: 0
Views: 511
Reputation: 2857
You cannot disable a feature of a 3rd-party component unless that component gives you a way of disabling it. You could use DOM Selectors and add the class '.disabled' but, unless the component is designed to respond to this class, this likely won't accomplish anything. Could the shared component be updated to take a disabled flag or some configuration @Input
?
Just for reference, selecting via a class and adding the class '.disabled' can be done via the following:
const dropDown = document.querySelector('.some-class');
if (dropDown.classList) {
dropDown.classList.add('disabled');
} else {
dropDown.className += ' disabled';
}
Upvotes: 1