Skip to content

Instantly share code, notes, and snippets.

@splincode
Created October 6, 2019 19:36
Show Gist options
  • Save splincode/97da7881af409d95c27c9512f42f94d2 to your computer and use it in GitHub Desktop.
Save splincode/97da7881af409d95c27c9512f42f94d2 to your computer and use it in GitHub Desktop.
@State<PreferencesStateModel>({ ... })
export class PreferencesState { ... }
@State<string[]>({ ... })
export class ZooState {
@Selector([ZooState, PreferencesState])
public static firstLocalPanda(state: string[], preferencesState: PreferencesStateModel) {
return state.find(val => val.indexOf('panda') > -1 && val.indexOf(preferencesState.location)
);
}
@Selector([ZooState.firstLocalPanda])
public static happyLocalPanda(panda: string) {
return 'happy ' + panda;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment