小编Lip*_*taa的帖子

Angular 2:将服务注入课堂

我有代表形状的角度类.我希望能够使用构造函数实例化该类的多个实例.

构造函数采用多个参数来表示该形状的属性.

constructor(public center: Point, public radius: number, fillColor: string,
    fillOpacity: number, strokeColor: string, strokeOpacity: number, zIndex: number)
Run Code Online (Sandbox Code Playgroud)

在我的课程中,我想使用提供在地图上绘制形状的功能的服务.是否可以将该服务注入到我的类中,并仍然以标准方式使用构造函数.

所以我想做类似下面的事情并让Angular自动解决注入的依赖关系.

constructor(public center: GeoPoint, public radius: number, 
    fillColor: string, fillOpacity: number, strokeColor: string, strokeOpacity: number, 
    zIndex: number, @Inject(DrawingService) drawingService: DrawingService)
Run Code Online (Sandbox Code Playgroud)

dependency-injection typescript angular

26
推荐指数
4
解决办法
2万
查看次数

尝试在 Centos (Rhel 7.5) 上运行 google-chrome 时无法打开 X 显示

我需要使用 SSH 在虚拟机上远程运行 Google Chrome。我不想要 xforwarding - 我想利用虚拟机上可用的 GPU。当我尝试运行时,出现 google-chrome以下错误:

[19615:19615:0219/152933.751028:ERROR:browser_main_loop.cc(1512)] Unable to open X display.
Run Code Online (Sandbox Code Playgroud)

我试图将我的 DISPLAY env 值设置为各种值:

export DISPLAY=localhost:0.0
export DISPLAY=127.0.0.1:0.0
export DISPLAY=:0.0
Run Code Online (Sandbox Code Playgroud)

我还尝试用不同的值替换 abowe 示例中的 0.0 。

ForwardX11 no在 /etc/ssh/sshd_config 中尝试设置这样的目标:

systemctl isolate multi-user.target
Run Code Online (Sandbox Code Playgroud)

当我尝试运行时,sudo lshw -C display我得到以下输出:

   *-display
       description: VGA compatible controller
       product: Hyper-V virtual VGA
       vendor: Microsoft Corporation
       physical id: 8
       bus info: pci@0000:00:08.0
       version: 00
       width: 32 bits
       clock: 33MHz
       capabilities: vga_controller bus_master rom
       configuration: driver=hyperv_fb latency=0
       resources: …
Run Code Online (Sandbox Code Playgroud)

ssh centos x11-forwarding

22
推荐指数
1
解决办法
5万
查看次数