Design Time Modification of Angular Component State with Slice

Scenario

We are using Slice as a Central Reactive State Manager for our Angular application, and we want to check verify / debug component behavior during development.

Approach

Create a temporary service and inject both the central state service and the action service and call methods on the action service that initialize the components state context:

@Injectable({
providedIn: 'root'
})
export class TempService {
constructor(
private a:ActionsService,
private s:StateService ) {
this.a.onFixedParameters()
}
}

The application state and actions can now be triggered from this service. Remember to inject it into app.component.ts .

Related

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ole Ersoy

Ole Ersoy

Founder of Firefly Semantics Corporation