I want to use a @Component
inside a table, but I think I can't use Angular
<tags>
inside the elements <tr>
of a table. I can't use a @Directive
because I want to include html. What should I do?
I have the following in my-page.html
:
<tr my-tag SOME_THINGS></tr>
Then, in my-component.ts
I have
@Component({
selector: '[my-tag]',
templateUrl: './my-tag.html',
styleUrls: ['./my-tag.scss']
})
and in my-component.html
I have:
<td>blah blah blah</td>
@Component
is called inside a tr
as a directive but it's not, because I want to include some html in it.
This raises the following tslint
error:
The selector of the component "my-tag" should be used as element (https://angular.io/styleguide#style-05-03) (component-selector)
If I do the following:
@Component({
selector: 'app-my-tag',
templateUrl: './my-tag.html',
styleUrls: ['./my-tag.scss']
})
together with
<tr><app-my-tag></app-my-tag></tr>
I don't get lint errors, but it looks really weird to me, and I lose the style of the rows.
Which would be a possible solution?
Thank you!