【发布时间】:2015-03-06 07:16:30
【问题描述】:
如何将此配置应用到我的组件。我使用的是我自己设置的控制器,但是我怎样才能像在 jquery 插件中一样提供默认的配置选项集:
$.fn.helloWorld = function( options ) {
// Establish our default settings
var settings = $.extend({
descriptionTemplate.content: 'Hello, World!',
type : 'tab',
id : null
}, options);
}
我的控制器正在提供这个对象:
vm.tabs = [
{
id: '1',
type: 'tab',
sections: {
tabTitle: 'The Caribbean'
},
descriptionTemplate : {
content: 'text goes here'
},
active: true
}
];
【问题讨论】:
-
您应该创建一个相应的提供程序并进行配置。来自documentation:“只有当您想要公开一个必须在应用程序启动之前进行的应用程序范围配置的 API 时,您才应该使用 Provider 配方。”
标签: angularjs tabs angularjs-scope angular-ui-bootstrap