在RxJS 6中取消订阅的最佳方法是什么?
我的'旧'RxJS 5代码看起来如此
export class MyComponent implements OnInit, OnDestroy {
private ngUnsubscribe: Subject<any> = new Subject();
this.myService.myEventEmitter
.takeUntil(this.ngUnsubscribe)
.subscribe(this.onDataPolling.bind(this));
public ngOnDestroy(): void {
this.ngUnsubscribe.next();
this.ngUnsubscribe.complete();
}
}
Run Code Online (Sandbox Code Playgroud)
在迁移到RxJS 6时,我跑了rxjs-5-to-6-migrate并得到了
this.myService.myEventEmitter.pipe(
takeUntil(this.ngUnsubscribe))
.subscribe(this.onDataPolling.bind(this));
Run Code Online (Sandbox Code Playgroud)
但这不起作用,因为EventEmitter没有管道方法.
在RxJS 6中取消订阅的最佳方法是什么?
编辑:这在干净安装后确实有效,是在RxJS 6中取消订阅的最佳方式.
角度材质从 14 迁移到 15 后,出现此错误:
Error: NG0300: Multiple components match node with tagname button: MatButton and MatIconButton
Run Code Online (Sandbox Code Playgroud)
想法如何解决这个问题?
我正在将角度应用程序从5迁移到6.运行
ng update @angular/cli和 ng update @angular/core
但现在,如果我跑ng build,我得到这个错误
Cannot find module 'typescript' from 'C:\..\App'
Error: Cannot find module 'typescript' from 'C:\..\App'
at Function.module.exports [as sync] (C:\..\App\MyApp\node_modules\resolve\lib\sync.js:42:15)
at resolveProjectModule (C:\..\App\MyApp\node_modules\@angular-devkit\build-angular\src\angular-cli-files\utilities\require-project-module.js:15:20)
at Object.requireProjectModule (C:\..\App\MyApp\node_modules\@angular-devkit\build-angular\src\angular-cli-files\utilities\require-project-module.js:20:20)
at BrowserBuilder.buildWebpackConfig (C:\..\App\MyApp\node_modules\@angular-devkit\build-angular\src\browser\index.js:103:52)
at Observable.rxjs_1.Observable.obs [as _subscribe] (C:\..\App\MyApp\node_modules\@angular-devkit\build-angular\src\browser\index.js:35:38)
at Observable._trySubscribe (C:\..\App\MyApp\node_modules\rxjs\internal\Observable.js:43:25)
at Observable.subscribe (C:\..\App\MyApp\node_modules\rxjs\internal\Observable.js:29:22)
at C:\..\App\MyApp\node_modules\rxjs\internal\util\subscribeTo.js:22:31
at Object.subscribeToResult (C:\..\App\MyApp\node_modules\rxjs\internal\util\subscribeToResult.js:7:45)
at MergeMapSubscriber._innerSub (C:\..\App\MyApp\node_modules\rxjs\internal\operators\mergeMap.js:75:38)
at MergeMapSubscriber._tryNext (C:\..\App\MyApp\node_modules\rxjs\internal\operators\mergeMap.js:72:14)
at MergeMapSubscriber._next (C:\..\App\MyApp\node_modules\rxjs\internal\operators\mergeMap.js:55:18)
at MergeMapSubscriber.Subscriber.next (C:\..\App\MyApp\node_modules\rxjs\internal\Subscriber.js:64:18)
at TapSubscriber._next (C:\..\App\MyApp\node_modules\rxjs\internal\operators\tap.js:62:26)
at TapSubscriber.Subscriber.next (C:\..\App\MyApp\node_modules\rxjs\internal\Subscriber.js:64:18)
at MergeMapSubscriber.notifyNext (C:\..\App\MyApp\node_modules\rxjs\internal\operators\mergeMap.js:84:26)
Run Code Online (Sandbox Code Playgroud)
package.json包含"typescript": ">=2.7.0 <2.8.0" …
我已将webApi asp.net5应用程序更新为beta8,无法再发布到文件系统.
构建似乎工作,我可以调试和运行应用程序,但如果我尝试发布我得到这样的错误...
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(156,5): Error : Build failed.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(11,20): Error NU1001: The dependency AntiXSS >= 4.2.1 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(12,24): Error NU1001: The dependency Devshed.Csv >= 1.3.8 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(13,27): Error NU1001: The dependency Devshed.Shared >= 1.3.7 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(14,22): Error NU1001: The dependency DotNetZip >= 1.9.2 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(15,29): Error NU1001: The dependency Iesi.Collections >= 3.2.0.4000 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(16,25): Error NU1001: The dependency MongoDB.Bson >= 2.0.0 could not …Run Code Online (Sandbox Code Playgroud) 如何检查字符串是否包含机器人框架中的其他字符串?
就像是
${bool} | String Contains | Hello World | World
Run Code Online (Sandbox Code Playgroud)
Get Substring没有帮助,因为它需要一个起始索引.
我已将ASP.NET 5更新为beta8,并将依赖项更改为"Microsoft.AspNet.Cors":"6.0.0-beta8".
之后我在ConfigureServices中遇到错误
services.ConfigureCors(options => { options.AddPolicy("AllowAllOrigins", builder => builder.AllowAnyOrigin()); });
Run Code Online (Sandbox Code Playgroud)
错误CS1929'IServiceCollection'不包含'ConfigureCors'的定义,并且最佳扩展方法重载'MvcCorsMvcCoreBuilderExtensions.ConfigureCors(IMvcCoreBuilder,Action)'需要类型为'IMvcCoreBuilder'的接收器WebAPI.DNX 4.5.1 C:...\Startup.cs
我该如何解决它并激活CORS?
像这样的简单表格
<form [formGroup]="myForm">
<mat-form-field class="my-light-field">
<mat-label>Name</mat-label>
<input matInput type="text" [value]="myObj?.name" required readonly/>
</mat-form-field>
</form>
Run Code Online (Sandbox Code Playgroud)
我喜欢让现场变得透明
.my-light-field {
.mdc-text-field--filled{
background-color: transparent !important;
}
}
Run Code Online (Sandbox Code Playgroud)
盘旋在田野上空时,天色越来越暗。是否可以删除悬停效果?还有对焦...