MCPcopy
hub / github.com/angular/components / closeSubMenuOf

Method closeSubMenuOf

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

* Pop items off of the stack up to but excluding `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 element which should be left on the stack * @return whether or not an item was removed from the

(lastItem: MenuStackItem)

Source from the content-addressed store, hash-verified

147 * @return whether or not an item was removed from the stack
148 */
149 closeSubMenuOf(lastItem: MenuStackItem) {
150 let removed = false;
151 if (this._elements.indexOf(lastItem) >= 0) {
152 removed = this.peek() !== lastItem;
153 while (this.peek() !== lastItem) {
154 this._close.next({item: this._elements.pop()!});
155 }
156 }
157 return removed;
158 }
159
160 /**
161 * Pop off all MenuStackItems and emit each one on the `close` observable one by one.

Callers 3

_openMethod · 0.80
closeOpenSiblingsMethod · 0.80
_closeSiblingTriggersMethod · 0.80

Calls 2

peekMethod · 0.95
nextMethod · 0.45

Tested by

no test coverage detected