本文整理匯總了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();
}