mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
39 lines
927 B
TypeScript
39 lines
927 B
TypeScript
import { ContentChildren, Directive, ElementRef, forwardRef, Optional, Inject, Renderer } from '@angular/core';
|
|
|
|
import { Button } from '../button/button';
|
|
import { Config } from '../../config/config';
|
|
import { Ion } from '../ion';
|
|
import { Navbar } from './navbar';
|
|
import { Toolbar } from './toolbar';
|
|
|
|
|
|
/**
|
|
* @hidden
|
|
*/
|
|
@Directive({
|
|
selector: 'ion-buttons,[menuToggle]'
|
|
})
|
|
export class ToolbarItem extends Ion {
|
|
inToolbar: boolean;
|
|
|
|
constructor(
|
|
config: Config,
|
|
elementRef: ElementRef,
|
|
renderer: Renderer,
|
|
@Optional() toolbar: Toolbar,
|
|
@Optional() @Inject(forwardRef(() => Navbar)) navbar: Navbar
|
|
) {
|
|
super(config, elementRef, renderer, 'bar-buttons');
|
|
this.inToolbar = !!(toolbar || navbar);
|
|
}
|
|
|
|
@ContentChildren(Button)
|
|
set _buttons(buttons: any) {
|
|
if (this.inToolbar) {
|
|
buttons.forEach((button: Button) => {
|
|
button.setRole('bar-button');
|
|
});
|
|
}
|
|
}
|
|
}
|