如何覆盖角材料2日期选择器的模板 [英] How to override template for angular material 2 datepicker
问题描述
我需要修改角度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?
推荐答案
您有两种方法:
- 创建一个扩展物料日期选择器的新组件,并为您分配获胜模板
- 覆盖一些重要的CSS规则以更改其外观
这篇关于如何覆盖角材料2日期选择器的模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!