基于台式机或移动设备的Angular 2不同视图 [英] Angular 2 different views based on Desktop or Mobile

查看:70
本文介绍了基于台式机或移动设备的Angular 2不同视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在网站上工作,该网站的功能基于台式机/移动版略有不同.

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

我试图通过@View应用它,但是看起来这个装饰器现在已被弃用. 请告诉我最佳实践,即如何在Angular 2中实现此功能.

I tried to apply it via @View, but it looks like this decorator is now deprecated. Please, advise me best practice, how to implement this feature in Angular 2.

推荐答案

ng2-responsive软件包应满足您的需求: https://www.npmjs.com/package/ng2-响应

The ng2-responsive package should cover your needs: https://www.npmjs.com/package/ng2-responsive

我还没有广泛使用它,但是它似乎做得不错.

I haven't used it extensively yet, but it seems to be doing a decent job.

@View被合并到@Component中(以前). @Component应该是您唯一需要的装饰器.

@View was merged into @Component (ages ago). @Component should be the only decorator you need.

这篇关于基于台式机或移动设备的Angular 2不同视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆