MCPcopy Index your code
hub / github.com/angular/components / close

Method close

src/cdk/menu/menu-stack.ts:128–141  ·  view source on GitHub ↗

* Pop items off of the stack up to and including `lastItem` and emit each on the close * observable. If the stack is empty or `lastItem` is not on the stack it does nothing. * @param lastItem the last item to pop off the stack. * @param options Options that configure behavior on close.

(lastItem: MenuStackItem, options?: CloseOptions)

Source from the content-addressed store, hash-verified

126 * @param options Options that configure behavior on close.
127 */
128 close(lastItem: MenuStackItem, options?: CloseOptions) {
129 const {focusNextOnEmpty, focusParentTrigger} = {...options};
130 if (this._elements.indexOf(lastItem) >= 0) {
131 let poppedElement;
132 do {
133 poppedElement = this._elements.pop()!;
134 this._close.next({item: poppedElement, focusParentTrigger});
135 } while (poppedElement !== lastItem);
136
137 if (this.isEmpty()) {
138 this._empty.next(focusNextOnEmpty);
139 }
140 }
141 }
142
143 /**
144 * Pop items off of the stack up to but excluding `lastItem` and emit each on the close

Callers 5

_backArrowPressedMethod · 0.45
closeOpenMenuFunction · 0.45
updateMethod · 0.45
_handleKeyEventMethod · 0.45
_handleKeyEventMethod · 0.45

Calls 2

isEmptyMethod · 0.95
nextMethod · 0.45

Tested by

no test coverage detected