我在我的 Angular 项目中使用 NgRx。我想从我的 访问存储在我的商店中的产品ProductsComponent。
ProductsComponent.ts
...
import { select, Store } from '@ngrx/store';
...
constructor(private store: Store<any>) {}
Run Code Online (Sandbox Code Playgroud)
我想知道以下之间有什么区别:
public products = this.store.select(selectProducts);
Run Code Online (Sandbox Code Playgroud)
和
public products = this.store.pipe(select(selectProducts));
Run Code Online (Sandbox Code Playgroud)
以及我应该使用哪一个。
我实际上正在开发一个需要推送通知的 Xamarin Forms 应用程序。我使用 Plugin.PushNotification 插件。
当应用程序在前台运行或正在睡眠(OnSleep)时,当我单击收到的通知时,打开特定页面没有问题。但我想知道当应用程序关闭时我该如何做到这一点。谢谢!
我正在开发不需要后退按钮的 Xamarin Forms App (PCL)。该应用程序有三个页面:一个SplashScreenPage用于加载数据,一个LoginPage是否需要用户登录,一个RootPage是MasterDetailPage. 我想知道在页面之间导航的最佳选择是什么(例如避免内存泄漏):
第一个解决方案:
Application.Current.MainPage = new ContentPage();
Run Code Online (Sandbox Code Playgroud)
第二种解决方案:
Navigation.PushAsync(new NavigationPage(new ContentPage()));
Run Code Online (Sandbox Code Playgroud)
然后
NavigationPage.SetHasNavigationBar(this, false);
ClearNavigationStack();
Run Code Online (Sandbox Code Playgroud)
第三种解决方案
await Navigation.PushModalAsync(new NavigationPage(new ContentPage()));
Run Code Online (Sandbox Code Playgroud)
然后
NavigationPage.SetHasNavigationBar(this, false);
ClearModalStack();
Run Code Online (Sandbox Code Playgroud)