My goal is to change the layout of the grid on a certain button press. I've already got the method binding setup, but I'm not sure how to reference the :host
styles. I could just wrap everything in a div and then reference that, but it feels sort of hack-y. How do I go about referencing the :host{} object?
component.ts, HTML and CSS:
@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.css']
})
export class DashboardComponent {
editHostStyles() {
//How do I make the reference here?
}
}
:host {
display: grid;
width: 100%;
height: 100%;
row-gap: 2px;
column-gap: 2px;
grid-template-columns: 300px 1fr 1fr;
grid-template-rows: 300px 1fr 1fr;
}
<button mat-raised-button class="primary-button" (click)="editHostStyles()">Update Style!</button>