Skip to content

Commit 07b7549

Browse files
committed
use locals object to pass variables to the template's scope
1 parent c9d5c0c commit 07b7549

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/ui/public/kbn_top_nav/kbn_top_nav_controller.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default function ($compile) {
1818
interval: intervalTemplate,
1919
filter: filterTemplate,
2020
};
21-
this.controllers = [];
21+
this.locals = {};
2222

2323
this.addItems(opts);
2424
}
@@ -36,8 +36,8 @@ export default function ($compile) {
3636
this.opts.push(opt);
3737
if (!opt.hideButton()) this.menuItems.push(opt);
3838
if (opt.template) this.templates[opt.key] = opt.template;
39-
if (opt.controller) {
40-
this.controllers[opt.key] = opt.controller;
39+
if (opt.locals) {
40+
this.locals[opt.key] = opt.locals;
4141
}
4242
});
4343
}
@@ -111,8 +111,8 @@ export default function ($compile) {
111111
}
112112

113113
const $childScope = $scope.$new();
114-
if (this.controllers[currentKey]) {
115-
$childScope.controller = this.controllers[currentKey];
114+
if (this.locals[currentKey]) {
115+
Object.assign($childScope, this.locals[currentKey]);
116116
}
117117
const $el = $element.find('#template_wrapper').html(templateToRender).contents();
118118
$compile($el)($childScope);

0 commit comments

Comments
 (0)