I am facing a situation where I need to customize the template of a third party component that I have imported. However, since this component is part of an npm package, I want to avoid making direct changes to it in order to prevent issues when updating the package in the future.
Is there a way to override the template of another component without modifying its original source code?
I am familiar with using <ng-content>
for injecting elements, but it's not suitable in this case.
The structure of the HTML looks like this:
<third-party-component [items]="items" [example]="example">
The controller includes something similar to this:
import {THIRD_PARTY_DIRECTIVES} from 'ng2-select/ng2-select';
@Component({
selector: 'example-component',
directives: [THIRD_PARTY_DIRECTIVES]
})
export class Example {
private items: Array<string> = [
'whatever', 'whatever2', 'whatever3'
];
}
Is there a method that allows me to specify the desired template for <third-party-component>
without directly altering the component declaration? Perhaps even through extending it?