0
Follow the codes. Despite hiding the menu, it does not open again with the "click" function in Nav-Burger
menu.:
section class="hero outer is-primary is-fullheight animated slideInLeft" [ngClass]="{'is-hidden' : !menu.opened}">
menu.service.ts:
@Injectable()
export class MenuService {
opened: boolean;
constructor() { }
open (){
this.opened = true;
}
}
header.componentts.:
@Component({
providers: [MenuService],
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.sass']
})
export class HeaderComponent implements OnInit {
constructor(public menu:MenuService) {
html header:
<div class="navbar-burger burger" (click)="menu.open()">
<span></span>
<span></span>
<span></span>
</div>