vladotesanovic / ngSemantic

Angular 2 building blocks :package: based on Semantic UI
https://ng-semantic.herokuapp.com/
MIT License
973 stars 148 forks source link

Show sidebar by default #164

Open tkoseoglu opened 7 years ago

tkoseoglu commented 7 years ago

Hi, If I wanted to show a sidebar by default, what would I need to do? Thanks --tolga

willwolfram18 commented 7 years ago

Assuming normal sidebar behavior, your angular component could implement AfterViewInit and using an @ViewChild(SemanticSidebarComponent) you could call .show().

import { Component, AfterViewInit } from "@angular/core";
import { SemanticSidebarComponent } from "ng-semantic";

@Component({/* Component data here */})
export class AppComponent
{
    @ViewChild(SemanticSidebarComponent)
    sidebar: SemanticSidebarComponent;

    ngAfterViewInit()
    {
        this.sidebar.show();
    }
}