@docs-private
(changes: SimpleChanges)
| 255 | |
| 256 | /** @docs-private */ |
| 257 | ngOnChanges(changes: SimpleChanges) { |
| 258 | this._checkForErrors(); |
| 259 | if (!this._registered || 'name' in changes) { |
| 260 | if (this._registered) { |
| 261 | this._checkName(); |
| 262 | if (this.formDirective) { |
| 263 | // We can't call `formDirective.removeControl(this)`, because the `name` has already been |
| 264 | // changed. We also can't reset the name temporarily since the logic in `removeControl` |
| 265 | // is inside a promise and it won't run immediately. We work around it by giving it an |
| 266 | // object with the same shape instead. |
| 267 | const oldName = changes['name'].previousValue; |
| 268 | this.formDirective.removeControl({name: oldName, path: this._getPath(oldName)}); |
| 269 | } |
| 270 | } |
| 271 | this._setUpControl(); |
| 272 | } |
| 273 | if ('isDisabled' in changes) { |
| 274 | this._updateDisabled(changes); |
| 275 | } |
| 276 | |
| 277 | if (isPropertyUpdated(changes, this.viewModel)) { |
| 278 | this._updateValue(this.model); |
| 279 | this.viewModel = this.model; |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | /** @docs-private */ |
| 284 | ngOnDestroy(): void { |
nothing calls this directly
no test coverage detected