Hello people of StackOverflow!
I am having some trouble with my code. As you can see, I want to be able to call a row with a set width (bootstrap format), as I don't want to type the class every time.
So I thought of a way which is the following:
import { Component, Input } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'content',
template: ` <div class="row">
<div [ngClass]="contentClass"
id="content"
[ngStyle]="{ 'color': 'black', 'font-size': '20px' }">
<ng-content></ng-content>
</div>
</div>`,
styleUrls: ['content.stylesheet.css']
})
export class ContentComponent {
@Input() rowWidth = "12";
contentClass=(("col-lg-" + this.rowWidth)+(" col-sm-" + this.rowWidth)+(" col-xs-" + this.rowWidth));
}
But once I call the component from another component, it's not working the way I want.
<banner bannerHeight="300px"></banner> <!-- This works -->
<content rowWidth="6"></content> <!-- This doesn't -->
If I used for example
<content [ngStyle]="{'color': 'black'}"></content>
the operation succeeds. The directives and imports are set correctly in the parent component.
So here is my question: How do I make it work the way I want it to?