O'Reilly logo

NativeScript for Angular Mobile Development by Nathanael J. Anderson, Nathan Walker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Providing the initial app state excluding any lazily loaded module state

We want to start by defining the initial app state, excluding any lazily loaded feature module state. Since our CoreModule provides AuthService, which deals with handling our user, we will consider the user slice a fundamental key to our app's initial state.

In particular, let's begin by defining the shape of our user state. Create app/modules/core/states/user.state.ts:

export interface IUserState {  recentUsername?: string;  current?: any;  loginCanceled?: boolean;}export const userInitialState: IUserState = {};

Our user state is very simple. It contains a recentUsername representing a string of the most recently successfully authenticated username (useful if the user ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required