如何覆盖角材料 2 日期选择器的模板 [英] How to override template for angular material 2 datepicker

查看:22
本文介绍了如何覆盖角材料 2 日期选择器的模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要修改 angular 2 材质日期选择器的模板.它的模板在@angular/material/esm5/datepicker.es5.js 中定义的几个内部组件中声明.

I need to modify the templates for the angular 2 material date-picker. Its templates are declared in several internal components that are defined in @angular/material/esm5/datepicker.es5.js.

我可以直接在节点包中修改模板,但是更新时它会被覆盖.

I could modify the template directly in the node package, but then it would get overwritten when updating.

我认为这是可能的唯一两种方法是,如果我动态修改模板(这真的可能吗?),或者如果我在本地复制整个角度材质节点包,然后修改它(最好的方法是什么?去做这个?).想法?

The only two ways I can see this being possible is if I modify the template dynamically (is this really possible?), or if I copy over the entire angular material node package locally and then modify that (what is the best way to do this?). Thoughts?

推荐答案

你有两种方式:

  1. 创建一个扩展材料日期选择器的新组件并分配您赢得的模板
  2. 覆盖一些 Material css 规则以改变其外观

这篇关于如何覆盖角材料 2 日期选择器的模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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