Skip to content

Commit

Permalink
README Cleanup "Working with dynamically inserted and removed steps" (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
madoar committed May 9, 2020
1 parent 7b7214a commit ea5d6a1
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions README.md
Expand Up @@ -698,27 +698,13 @@ For additional information about how to write your own navigation bar please tak
[wizard-navigation-bar.scss](src/css/wizard-navigation-bar.scss) file.

### Working with dynamically inserted and removed steps
In some cases it may be required to remove or insert one or multiple steps after the wizard initialization,
for example after a user does some interaction with the wizard, it may be required to add or remove a later step.
In some cases it may be required to remove or insert one or multiple steps after the wizard initialization.
For example after a user does some interaction with the wizard, it may be required to add or remove a later step.
In such situations the wizard supports the removal and insertion of steps in the DOM.

If you require the dynamic removal or insertion of steps, please be aware that the angular component containing the wizard
needs to trigger a `detectChanges()` call inside the `afterViewInit` lifecycle phase.
This call can be triggered by adding the following lines to the component class:
```typescript
constructor(private _changeDetectionRef: ChangeDetectorRef) {}

ngAfterViewInit(): void {
// Force another change detection in order to fix an occuring ExpressionChangedAfterItHasBeenCheckedError
this._changeDetectionRef.detectChanges();
}
```

If an earlier step, compared to the current step, has been removed or inserted,
the wizard will adjust the index of the current step to make the changed state valid again.
If an earlier step, compared to the current step, has been removed or inserted, the wizard will adjust the current step to ensure that the changed state is valid again.

Please be also sure to not remove the step, the wizard is currently displaying, because otherwise the wizard will be inside an
invalid state, which may lead to strange and unexpected behavior.
When removing a step be sure to not remove the step the wizard is currently displaying, because otherwise the wizard will be inside an invalid state, which may lead to strange and unexpected behavior.

## Styles Customization

Expand Down

0 comments on commit ea5d6a1

Please sign in to comment.