Bootstrap has the following example of an action group. The result is that the buttons inside the group are merged together.
Inside my Angular project I already have a toolbar and wanted to apply these styles on them. Basically I have a ToolbarComponent
and an ActionComponent
.
The idea works fine as long as I put everything in 1 component without the sublevel of an ActionComponent
. But when I seperate them (as shown in the picture above), then things don't work any more.
The buttons are not merged (look at the corners of the buttons).
When I open the runtime html code in google chrome, it shows the following:
As you can see, there's a level in-between the <div class="btn-group">
and <div class="btn">
. (i.e. the tag of the ActionComponent
itself: <objt-action>
). My best guess, is that this tag messes things up.
My best guess, is that this additional tag breaks the bootstrap logic.
So, now I'm wondering about the best strategy to solve my problem.
VIEW CODE OF ToolbarComponent
<div class="d-flex flex-wrap justify-content-start" role="toolbar" aria-label="toolbar">
<!-- iterate action-groups -->
<div *ngFor="let actionGroup of actionGroups" class="btn-group p-1" role="group">
<!-- for each action-group, iterate thru the actions of the group -->
<ng-template ngFor let-action [ngForOf]="actionGroup.actions">
<objt-action [action]="action" (actionClicked)="actionClicked($event)"></objt-action>
</ng-template>
</div>
</div>
EDIT
In mean time, I also tried it by changing the directive of the component, from objt-action
to [objt-action]
. By doing so, I can define the ActionComponent
as follows inside the ToolbarComponent
's view:
<div objt-action> </div>
But the resulting xml is still invalid, there still remains a disturbing intermediate level, i.e. the <div objt-action>
itself.