Skip to content

Instantly share code, notes, and snippets.

@braindroplabs
Created May 7, 2016 17:38
Show Gist options
  • Save braindroplabs/c536b236c467cda2666952f3cd712a65 to your computer and use it in GitHub Desktop.
Save braindroplabs/c536b236c467cda2666952f3cd712a65 to your computer and use it in GitHub Desktop.
I'm looking for the lightest approach for allowing the buttons transcluded within <app-control-panel-button> to notify components in <app-control-panel-body> that they've been clicked.
<div class="row">
<div class="col-md-4">
<!-- Images Component -->
<app-control-panel label="Images">
<app-control-panel-button>
<button class="pull-right">Shuffle</button>
</app-control-panel-button>
<app-control-panel-body>
<app-image-select></app-image-select>
</app-control-panel-body>
</app-control-panel>
</div>
<div class="col-md-4">
<!-- Canvas Component -->
<app-control-panel label="Canvas">Canvas Body...</app-control-panel>
</div>
<div class="col-md-4">
<!-- Sizes Component -->
<app-control-panel label="Sizes"></app-control-panel>
<app-control-panel-body>
<app-sizes-select></app-sizes-select>
</app-control-panel-body>
<!-- Filters Component -->
<app-control-panel label="Filters">
<app-control-panel-button>
<button class="pull-right">Reset</button>
</app-control-panel-button>
<app-control-panel-body>
<app-filters-select></app-filters-select>
</app-control-panel-body>
</app-control-panel>
<!-- Text Component -->
<app-control-panel label="Text">
<app-control-panel-body>
<app-text-select></app-text-select>
</app-control-panel-body>
</app-control-panel>
<!-- Logo Component -->
<app-control-panel label="Logo">
<app-control-panel-body>
<app-logo-select></app-logo-select>
</app-control-panel-body>
</app-control-panel>
</div>
</div>
@braindroplabs
Copy link
Author

braindroplabs commented May 7, 2016

My gut instinct is that I can have each ControlPanelComponent provide a public method that each transcluded button in an <app-control-panel-button> can call via (click)="onMyClick()". Then the ControlPanelComponent could provide a property that gets updated via the onMyClick() call and gets bound to whatever component I want transcluded via <app-control-panel-body>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment