Bootstrap has the following example group of actions. The result is that the buttons within the group are combined together.
Inside my Angular project, I already have a toolbar and you want to apply these styles to them. I mainly have ToolbarComponent and ActionComponent .

The idea works fine as long as I put everything in 1 component without an ActionComponent sublayer. But when I separate them (as shown in the figure above), then everything no longer works.
Buttons are not combined (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 is a level between <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 extra tag breaks the boot logic.
So now I’m interested in learning about the best strategy. to solve my problem.
VIEWING ToolbarComponent
<div class="d-flex flex-wrap justify-content-start" role="toolbar" aria-label="toolbar"> <div *ngFor="let actionGroup of actionGroups" class="btn-group p-1" role="group"> <ng-template ngFor let-action [ngForOf]="actionGroup.actions"> <objt-action [action]="action" (actionClicked)="actionClicked($event)"></objt-action> </ng-template> </div> </div>
EDIT
At the same time, I also tried this by changing the component directive, from objt-action to [objt-action] . By doing so, I can define an ActionComponent as follows inside the ToolbarComponent :
<div objt-action> </div>
But the resulting xml is still invalid, there is still an alarming intermediate layer, i.e. <div objt-action> .
angular twitter-bootstrap bootstrap-4
bvdb Aug 29 '17 at 10:40 2017-08-29 10:40
source share