This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class UserListRequest implements Action, LoadingAction { | |
readonly type = ActiontTypes.UserListRequest; | |
fxLoading = { add: ActiontTypes.UserListRequest }; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class UserListRequest implements Action { | |
readonly type = ActiontTypes.UserListRequest; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injectable() | |
export class UsersEffects { | |
@Effect() | |
private _onListRequest$ = this._actions$.pipe( | |
ofType('USER_LIST_REQUEST'), | |
map((action) => new LoadingAdd(action.type)) | |
); | |
constructor(private _actions$: Actions) { } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function reducer( | |
state = initialState, | |
action: Actions | |
) { | |
switch (action.type) { | |
case ActionTypes.Add: | |
return { data: [ ...state.data, action.payload ] }; | |
case ActionTypes.Remove: | |
return { data: state.data.filter((id) => id !== action.payload) }; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export enum ActionTypes { | |
Add = '[@my/loading] Add', | |
Remove = '[@my/loading] Remove' | |
} | |
export class Add { | |
readonly type = ActionTypes.Add; | |
constructor(public payload: string) { } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class State { | |
data: string[]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Users { | |
list[]: string; | |
loading: boolean; | |
constructor() { | |
this.list = []; | |
this.loading = false; | |
} | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div style="padding: 7px"> | |
<foo-cmp> | |
<md-input-container> | |
<input mdInput placeholder="Whatever" type="text" [formControl]="form.get('whatever')"> | |
</md-input-container> | |
<md-input-container> | |
<input mdInput placeholder="State" [mdAutocomplete]="auto" [formControl]="form.get('state')"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div style="padding: 7px"> | |
<button md-raised-button (click)="open = true">Open Dialog</button> | |
<dialog-cmp [open]="open"> | |
<md-input-container> | |
<input mdInput placeholder="Whatever" [formControl]="form.get('whatever')"> | |
</md-input-container> | |
<md-input-container> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div style="padding: 7px"> | |
<sub-component | |
[options]="options$ | async" | |
[param]="routeParam$ | async"> | |
</sub-component> | |
<sub-component | |
[options]="options$ | async" |
NewerOlder