so I'm using a template that I downloaded of ngx-admin.
I'm creating new lib of some simple components such as input with labels and etc. this lib component is style free, I would like to inject the ngx-admin styles to these components.
What shall be the best way to pass the syles and classes to the child lib components?
this is the template page.component.html which I'm using the new lib I created:
<div class="row">
<div class="col-xxl-5">
<div class="row">
<div class="col-md-12">
<nb-card>
<nb-card-header>Default Inputs</nb-card-header>
<nb-card-body>
<lib-input-with-lable></lib-input-with-lable> <- this is the lib I creared
</nb-card-body>
</nb-card>
</div>
</div>
</div>
Lib component:
import {Component, Input, OnInit} from '@angular/core';
@Component({
selector: 'lib-input-with-lable',
template: `
<div class="d-flex flex-row">
{{title}}
<input style="margin-left: 2rem"/>
</div>
`,
styleUrls: ['./input-with-lable.component.scss'],
})
export class InputAndLableComponent implements OnInit {
constructor() { }
@Input() title: string;
ngOnInit(): void {
}
}
This is how the template is using the classes for css style:
<input type="password" nbInput fullWidth placeholder="Password">
So I would like to have the ability to use nbInput & full width, which I added to page.component.scss
and I will like to use is some kind of
<lib-input-with-lable --passing here the styles--->
and inside
to use is like this:
@Component({
selector: 'lib-input-with-lable',
template: `
<div class="d-flex flex-row">
{{title}}
<input ------using here the style------- style="margin-left: 2rem"/>
</div>
`,
styleUrls: ['./input-with-lable.component.scss'],
})