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

查看:14
本文介绍了基于桌面或移动设备的 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-responsive

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天全站免登陆