MCPcopy Create free account
hub / github.com/angular/components / _startEditing

Method _startEditing

src/material/chips/chip-row.ts:195–220  ·  view source on GitHub ↗
(event?: Event)

Source from the content-addressed store, hash-verified

193 }
194
195 private _startEditing(event?: Event) {
196 if (
197 !this.primaryAction ||
198 (this.removeIcon &&
199 !!event &&
200 this._getSourceAction(event.target as Node) === this.removeIcon)
201 ) {
202 return;
203 }
204
205 // The value depends on the DOM so we need to extract it before we flip the flag.
206 const value = this.value;
207
208 this._isEditing = this._editStartPending = true;
209
210 // Defer initializing the input until after it has been added to the DOM.
211 afterNextRender(
212 () => {
213 this._getEditInput().initialize(value);
214
215 // Necessary when using edit icon to prevent edit from aborting
216 setTimeout(() => this._ngZone.run(() => (this._editStartPending = false)));
217 },
218 {injector: this._injector},
219 );
220 }
221
222 private _onEditFinish() {
223 this._isEditing = this._editStartPending = false;

Callers 4

_handleKeydownMethod · 0.95
_handleClickMethod · 0.95
_handleDoubleclickMethod · 0.95
_editMethod · 0.95

Calls 3

_getEditInputMethod · 0.95
_getSourceActionMethod · 0.80
initializeMethod · 0.65

Tested by

no test coverage detected