Skip to content

Instantly share code, notes, and snippets.

Aleš fxck

  • Prague
Block or report user

Report or block fxck

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View action-enh-2.ts
export class UserListRequest implements Action, LoadingAction {
readonly type = ActiontTypes.UserListRequest;
fxLoading = { add: ActiontTypes.UserListRequest };
}
View action-enh-1.ts
export class UserListRequest implements Action {
readonly type = ActiontTypes.UserListRequest;
}
View effects-basic.ts
@Injectable()
export class UsersEffects {
@Effect()
private _onListRequest$ = this._actions$.pipe(
ofType('USER_LIST_REQUEST'),
map((action) => new LoadingAdd(action.type))
);
constructor(private _actions$: Actions) { }
}
View loading-reducer-basic.ts
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) };
}
View loading-action-basic.ts
export enum ActionTypes {
Add = '[@my/loading] Add',
Remove = '[@my/loading] Remove'
}
export class Add {
readonly type = ActionTypes.Add;
constructor(public payload: string) { }
}
View standard-usecase.ts
class Users {
list[]: string;
loading: boolean;
constructor() {
this.list = [];
this.loading = false;
}
}
@fxck
fxck / app.component.html
Last active Mar 13, 2017
angular dialog stacking
View app.component.html
<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')">
@fxck
fxck / app.component.html
Created Mar 13, 2017
angular dialog stacking
View app.component.html
<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>
@fxck
fxck / app.component.html
Last active Mar 6, 2017
material2 overlayclickthru
View app.component.html
<div style="padding: 7px">
<sub-component
[options]="options$ | async"
[param]="routeParam$ | async">
</sub-component>
<sub-component
[options]="options$ | async"
You can’t perform that action at this time.