本文整理汇总了TypeScript中@ngrx/store.Store.let方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Store.let方法的具体用法?TypeScript Store.let怎么用?TypeScript Store.let使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ngrx/store.Store
的用法示例。
在下文中一共展示了Store.let方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(private store: Store<AppState>, private router: Router, private cd: ChangeDetectorRef,
private siteDataService: SiteDataService){
store.let(appSelectors.getRoutes).subscribe(routes => {
console.log(routes);
router.resetConfig(routes);
});
store.let(appSelectors.getSiteDataState).subscribe(siteData => {
this.isAdmin = siteData.isAdmin;
});
store.let(appSelectors.getSiteDataState).subscribe(siteData => {
this.adminModeActive = siteData.adminModeActive;
if(this.adminModeActive){
this.adminButtonMessage = 'Admin Mode: On';
this.adminButtonBackground = 'green';
}
else{
this.adminButtonMessage = 'Admin Mode: Off';
this.adminButtonBackground = '';
}
});
}
示例2: constructor
constructor(private store: Store<any>) {
this.sentences_nums = store.let(fromRoot.getSelectedExerciseSentencesNums);
this.sentences = store.let(fromRoot.getSelectedExerciseSentences);
this.missing_words = store.let(fromRoot.getSelectedExerciseMissingWords);
this.answers = store.let(fromRoot.getSelectedExerciseMissingWordsAnswers);
this.validated = store.let(fromRoot.isSelectedExerciseValidated);
}
示例3: constructor
constructor(
private store: Store<AppState>,
private nav: NavController
){
this.todos = store.let(getTodos());
this.undoEnabled = store.let(getUndoEnabled());
}
示例4: constructor
constructor(
private store: Store<AppState>,
private nav: NavController,
private bookActions: BookActions) {
/**
* Selectors can be applied with the `let` operator, which passes the source
* observable to the provided function. This allows us an expressive,
* composable technique for creating view projections.
*
* More on `let`: https://gist.github.com/btroncone/d6cf141d6f2c00dc6b35#let
* More on selectors: https://gist.github.com/btroncone/a6e4347326749f938510#extracting-selectors-for-reuse
*/
this.searchQuery$ = store.let(getSearchQuery()).take(1);
// this.searchQuery$ = this.store.select(s => s.search).select(s => s.query);
// this.searchQuery$ = store.select('search');
/*
this.searchQuery$ = Observable.create((subscriber) => {
subscriber.next('hello');
subscriber.next('world');
subscriber.complete();
});
*/
this.books$ = store.let(getSearchResults());
}
示例5: constructor
constructor(
private store: Store<fromRoot.State>,
private app: AppClientService
) {
this.topics$ = store.let(fromRoot.getTopicCollection).distinctUntilChanged();
this.categories$ = app.categories$;
this.pageCount$ = store.let(fromRoot.getPageCount).takeLast(1);
}
示例6: constructor
constructor(
private nav: NavController,
private store: Store<AppState>,
private authService: AuthService
) {
this.participant$ = this.store.let(getParticipant());
this.experiment$ = this.store.let(getExperiment());
this.participant$.subscribe(p => this.participant = p);
this.experiment$.subscribe(e => this.experiment = e);
}
示例7: constructor
constructor(private store: Store<AppState>, private bookActions: BookActions) {
/**
* Selectors can be applied with the `let` operator, which passes the source
* observable to the provided function. This allows us an expressive,
* composable technique for creating view projections.
*
* More on `let`: https://gist.github.com/btroncone/d6cf141d6f2c00dc6b35#let
* More on selectors: https://gist.github.com/btroncone/a6e4347326749f938510#extracting-selectors-for-reuse
*/
this.searchQuery$ = store.let(getSearchQuery()).take(1);
this.books$ = store.let(getSearchResults());
}
示例8: ngOnInit
ngOnInit() {
this.paymentProviders$ = this.store.let(getAllPaymentProviders)
.map(providers => providers.filter(provider => {
if (provider.enabled) {
// Provider must have asset types to be shown here
return !!provider.asset_types.length;
} else {
// Hide providers that do not have any asset types (these will never have property 'enabled' set to true)
return !PAY_WITHOUT_ASSETS_PROVIDERS.includes(provider.id);
}
}));
this.paymentProvidersStatus$ = this.store.let(getAllPaymentProvidersStatus);
this.store.dispatch(new GetAllPaymentProvidersAction());
}
示例9: ngOnInit
ngOnInit() {
this.store.dispatch(new GetAllAssetsAction());
this.store.dispatch(new GetPaymentProvidersAction());
this.assets$ = this.store.let(getAssets)
.combineLatest(this.store.let(getPaymentProviders))
.map(([ assets, providers ]) => {
return providers.map(provider => ({
provider: provider,
assets: assets.filter(asset => asset.provider_id === provider.id)
})
);
});
this.assetsStatus$ = this.store.let(getAssetsStatus);
}
示例10:
get promotions$(): Observable<Array<Promotion>> {
return this.store.let(fromRoot.content.getPromotions)
.do(v => {
if (!v)
this.store.dispatch(new apiAction.GetPromotionsAction());
}).share();
}