我刚刚开始使用远程 - SSH (ms-vscode-remote.remote-ssh) 插件。我把这段代码放入settings.json:
"remote.SSH.remotePlatform": {
"myserver": "linux"
}
Run Code Online (Sandbox Code Playgroud)
在文件中config:
Host myhost
HostName myhost
User root
IdentityFile ~/.ssh/id_rsa.pub
Run Code Online (Sandbox Code Playgroud)
正如文档所说,我期望 - 就像在 PuTTY 中一样 - 插件只需登录并完成,但它仍然要求登录密码。
有没有我错过的设置?或者是否有任何我必须应用的设置以避免询问密码?
在我的图书馆中,我有一个带有以下代码的服务:
import { Inject, Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { DataInjectorModule } from '../../data-injector.module';
// @dynamic
@Injectable()
export class RemoteDataService<T> {
@Inject('env') private environment: any = {};
public type: new () => T;
constructor(
model: T,
) {
this.http = DataInjectorModule.InjectorInstance.get(HttpClient);
}
// ...
}
Run Code Online (Sandbox Code Playgroud)
(现有原因data-injector.module只是避免循环依赖):
import { NgModule, Injector } from '@angular/core';
// @dynamic
@NgModule({
declarations: [],
imports: [],
providers: [],
exports: [],
})
export class DataInjectorModule {
static InjectorInstance: Injector; …Run Code Online (Sandbox Code Playgroud) 我想使用基于 WCAG 2.1 的可访问性 linting 升级我们的 GitHub 工作流程。如果可能的话,我也想将级别定义为AA.
我不想在网站上运行完整的测试,只想对拉取请求进行快速检查。整个站点测试将是下一步,但现在我只想专注于拉取请求。
我基于此检查了pa11y和几个存储库,但正如我所见,此解决方案只能测试一个工作网站,而不能测试拉取请求。
有什么可行的解决方案吗?
有什么方法可以只CSS用于定位 center plus x pixel adiv吗?
我现在有这个 CSS 代码:
#mydiv {
display: block;
width: 200px;
margin: 200px auto;
}
Run Code Online (Sandbox Code Playgroud)
我想将此 div 定位到中心 + 300px 到右侧。可以只使用 CSS 吗?
(我知道这是一种使用 jQuery 的方法,但我只想使用 CSS。)
我使用 Angular 8 并尝试使用抽象组件。我想在抽象类中定义 templateUrl 和 styleUrls,但在实现的类中定义选择器名称。像这样:
@Component({
// selector isn't defined here
templateUrl: './abstract-list.component.html',
styleUrls: ['./abstract-list.component.scss']
})
export abstract class AbstractListComponent<T> implements OnInit {
// ...
}
Run Code Online (Sandbox Code Playgroud)
而在幼儿班
@Component({
selector: 'app-my-custom-list',
// templateUrl & styleUrls is should be inherited
})
export class MyCustomListComponent extends AbstractListComponent<MyCustomListInterface> implements OnInit {
// ...
}
Run Code Online (Sandbox Code Playgroud)
我尝试仅在这样的实现中使用装饰器,但我觉得这里需要一个更好的方法:
@Component({
selector: 'app-my-custom-list',
templateUrl: '../../abstract-list/abstract-list.component.html',
styleUrls: ['../../abstract-list/abstract-list.component.scss']
})
Run Code Online (Sandbox Code Playgroud)
是否可以使用@Component类似这样的装饰器?或者对于这种用法有什么技巧或最佳实践吗?
我的 Angular + RxJS 应用程序中有一点复杂的管道结构:
远程数据.service.ts:
getAll(url): Observable<any[]> {
return this.http.get(url, this.options)
.pipe(map((result: any[]) => result));
}
Run Code Online (Sandbox Code Playgroud)
代理.服务.ts:
// localDataService use my LocalDataService
// remoteDataService use my RemoteDataService
getAll(model): Observable<any[]> {
if (model.use_localstorage) {
return this.localDataService.getAll(model)
.pipe(map((result: any[]) => result));
} else {
return this.remoteDataService.getAll(model.url)
.pipe(map((result: any[]) => result));
}
}
Run Code Online (Sandbox Code Playgroud)
助手.service.ts:
getAll(model): Observable<any[]> {
// do some general fancy things...
return this.proxyService.getAll(model)
.pipe(map((result: any) => result));
}
}
Run Code Online (Sandbox Code Playgroud)
然后在我的组件中:
export class MyComponent {
helperService = new HelperService(); …Run Code Online (Sandbox Code Playgroud) 我的项目我需要将我的分页器的pageSize值(每页项目数)与以前的值进行比较,如果新值更高,那么我需要从存储中加载数据。但如果它不是更高,我不想做任何事情。
例如在这段代码中:
export class MyComponent {
paginatorPageSize: BehaviorSubject<number> = new BehaviorSubject<number>(10);
// ...
savePageSettings() {
this.pageService.save().pipe(
map((result: any) => {
// ...
}),
tap(() => this.anyCode.here()),
switchMap((result: any) => {
// ...
}),
switchMap(() => {
const previousPageSize = ??? // <--- here how can I get the prevoius value of paginatorPageSize?
if (previousPageSize >= this.paginatorPageSize.value) {
return this.pageService.getAll();
}
return of(null)
})
).subscribe();
}
}
Run Code Online (Sandbox Code Playgroud)
有没有办法获得 RxJS Subject / BehavioSubject 或任何类型的主题的先前发出的值?
我刚刚开始使用 Laravel Sail (v1.4.7),如果我运行以下命令:
sail up -d
Run Code Online (Sandbox Code Playgroud)
然后所有容器启动。
然后我尝试运行这个:
sail composer dump-autoload
Run Code Online (Sandbox Code Playgroud)
响应是:
projectname- docker- Exit 1
Shutting down old Sail processes...
Sail is not running.
You may Sail using the following commands: './vendor/bin/sail up' or './vendor/bin/sail up -d'
Run Code Online (Sandbox Code Playgroud)
我尝试过composer dump-autoload无帆运行,效果很好。但这不是在容器内运行(所以将来它可能会在不同的版本上运行)。
更新:
我在 WSL2、Ubuntu 20.04 中运行容器。
为什么此时要关闭容器?但实际上不只是这个命令发生关闭。每个sail ...命令的发生都是相同的。
任何想法?
我刚刚将我的 Angular 6 项目升级到了 Angular 11。这个项目已经实现了 SSR,这是问题所在。
当我运行时,ng run myapp:server我收到此错误:
? Server application bundle generation complete.
Initial Chunk Files | Names | Size
main.js | main | 4.06 kB
| Initial Total | 4.06 kB
Build at: 2021-04-22T14:02:16.388Z - Hash: 2a6aaefe9d15b8a7dedc - Time: 4907ms
Error: Angular structure loaded both synchronously and asynchronously
Run Code Online (Sandbox Code Playgroud)
在我的angular.json我有这个代码:
? Server application bundle generation complete.
Initial Chunk Files | Names | Size
main.js | main | 4.06 kB
| Initial Total | …Run Code Online (Sandbox Code Playgroud) 我尝试在 Angular 11 项目中使用 Bootstrap 5.0.2,代码如下:
索引.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>My Project</title>
<base href="/">
<meta http-equiv="content-language" content="en-US" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</head>
<body>
<app-root></app-root>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
在组件中:
<a class="btn btn-primary"
data-bs-toggle="tooltip"
data-bs-html="true"
data-bs-placement="top"
[title]="myTitle | toHtmlEntity"
[href]="myUrl">
{{ myButtonLabel }}
</a>
Run Code Online (Sandbox Code Playgroud)
没有错误消息,但工具提示不起作用。当鼠标悬停在链接上时,标题字符串就会出现。
知道我错过了什么吗?
angular ×5
typescript ×3
rxjs ×2
angular10 ×1
angular8 ×1
bootstrap-5 ×1
css ×1
github ×1
html ×1
injectable ×1
jquery ×1
laravel-8 ×1
laravel-sail ×1
linter ×1
memory-leaks ×1
rxjs6 ×1
tooltip ×1
wcag ×1