全局配置 Angular 指令 [英] Globally configuring Angular directives

查看:23
本文介绍了全局配置 Angular 指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一些 Angular UI Bootstrap 指令,例如 datepicker,有如下配置说明this:所有设置都可以作为 中的属性提供,或者通过 datepickerConfig 全局配置."

Some of the Angular UI Bootstrap directives, such as datepicker, have configuration instructions like this: "All settings can be provided as attributes in the <datepicker> or globally configured through the datepickerConfig."

虽然列出了配置选项,但没有描述 *Config 是什么以及我如何全局配置一个.听起来这是 Angular 的标准部分.是吗?我如何使用这种配置模式,它在哪里记录?

Although the configuration options are listed, there is no description of what a *Config is and how I globally configure one. It sounds like this is a standard part of Angular. Is it? How do I use this configuration pattern, and where is it documented?

推荐答案

是这样的:

angular.module('myModule', ['ui.bootstrap'])

.config(['uibDatepickerConfig', function(uibDatepickerConfig) {
    uibDatepickerConfig.showWeeks = false;
}]);

这篇关于全局配置 Angular 指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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