This file contains 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 interface State { | |
mediaPlaying: boolean; | |
audioPlaying: boolean; | |
videoPlaying: boolean; | |
} |
This file contains 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
ngOnInit() { | |
this.store.dispatch({type: "GET_USERS"}); | |
} |
This file contains 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
ngOnDestroy() { | |
this.store.dispatch({type: "CANCEL_GET_USERS"}) | |
} |
This file contains 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
ngOnInit() { | |
this.users$ = this.userService.users$; | |
} |
This file contains 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 interface State { | |
items: {[index: number]: Item}; | |
favoriteItems: number[]; | |
} |
This file contains 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 favoriteItemsReducer(state = initialState, action: Action) { | |
switch(action.type) { | |
case 'REMOVE_FAVORITE_ITEM': | |
case 'DELETE_ITEM_SUCCESS': | |
const itemId = action.payload; | |
return state.filter(id => id !== itemId); | |
default: | |
return state; | |
} | |
} |
This file contains 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
import {Directive, Input} from '@angular/core'; | |
@Directive({ | |
selector: '[patchFormGroupValues]', | |
}) | |
export class PatchFormGroupValuesDirective { | |
@Input() formGroup: any; | |
@Input() | |
set patchFormGroupValues(val: any) { | |
if (!val) return; |
This file contains 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
import {Directive, Input} from '@angular/core'; | |
import {NgControl} from '@angular/forms'; | |
@Directive({ | |
selector: '[setValue]', | |
}) | |
export class SetValueDirective { | |
@Input() | |
set setValue(val: any) { | |
this.ngControl.control.setValue(val); |
This file contains 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
import {Directive, Input} from '@angular/core'; | |
@Directive({ | |
selector: '[disableFormGroup]', | |
}) | |
export class DisableFormGroupDirective { | |
@Input() form: any; | |
@Input() formGroupName: string; | |
@Input() | |
set disableFormGroup(disabled: boolean) { |
This file contains 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
import {Directive, Input} from '@angular/core'; | |
import {NgControl} from '@angular/forms'; | |
@Directive({ | |
selector: '[disableControl]', | |
}) | |
export class DisableControlDirective { | |
@Input() | |
set disableControl(disabled: boolean) { | |
const method = disabled ? 'disable' : 'enable'; |
OlderNewer