Angular 2 different views based on Desktop or Mobile

前端 未结 3 656
说谎
说谎 2021-02-03 12:12

I\'m working on web site, that has slight different functionality based on version desktop/mobile.

I tried to apply it via @View, but it looks like this decorator is now

3条回答
  •  野的像风
    2021-02-03 12:59

    @Component({
      selector: 'my-component',
      templateUrl: "./" + (window.screen.width > 900 ? 
                         "my-component.desktop.html" : 
                         "my-component.mobile.html"),
      styleUrls: ['./my-component.css']
    })
    

提交回复
热议问题