mardi 6 juin 2017

Typescript / Angular 4 else/if remove what if have done

In my project I need to load different methods which are based on an if/else "function"

this.viewPortService.value$.subscribe(size => {
  if(size == ViewportService.sizeSmall || size == ViewportService.sizeExtraSmall){
    this.showMobileMenu();
  } else {
    this.showDesktopMenu();
  }

The problem is when I resize the screen to toggle a breakpoint. So this is what I need:

If (do something) AND remove what else have done.
Else (do something) AND remove what if have done.

Aucun commentaire:

Enregistrer un commentaire