Angular2与Modernizr [英] Angular2 with modernizr

查看:99
本文介绍了Angular2与Modernizr的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习angular2并使用ng2-bootstrap构建自己的自定义组件.我想使用现代化工具来检测浏览器本身支持的表单输入.

I am learning angular2 and building my own custom components using ng2-bootstrap. I want to use modernizer to detect form input which are natively supported by browser.

我正在使用webpack来构建我的项目.我已经成功配置了它.

I am using webpack for building my project.I have successfully configured that.

到目前为止,我所做的是:

What I did till now is:

  1. 安装npm install -g modernizr
  2. 下载了modernizr-custom.js,仅检查了表单输入.
  3. 下载了modernizr-config.json
  4. 我做了modernizr -c modernizr-config.json来获取js文件.要使用


我不确定如何在自己的自定义组件中使用Modernizr.inputtypes.date?如何在组件中访问Modernizr变量?


I am not sure how to Modernizr.inputtypes.date in my own custom component?How we can access Modernizr variable in my component?

非常感谢您的帮助.

推荐答案

请按照以下步骤操作:

  1. 放置类型为Modernizr 进入您的项目文件夹.

  1. Place the type definition of Modernizr into your project folder.

modernizr.js放置在您的项目中,并使用类似的路径在任何组件中访问它:

Place the modernizr.js in your project and access it within any component using relative path like:

import './Lib/modernizr.js';

完成.您应该能够使用Modernizr来检测对浏览器功能的支持.

Done. You should be able to use the Modernizr to detect browser feature support.

这篇关于Angular2与Modernizr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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