2016-08-02 33 views
1

我在Angular 2中使用d3.js。由於模板元素是動態創建的,所以我必須使用「陰影穿透CSS組合器」。VS代碼 - Angular 2 Typescript - 如何刪除/修復css陰影穿孔錯誤?

:host /deep/ .arc-path:hover 
{ 
    fill: orange; 
} 

:host /deep/ .arc-path-sub:hover 
{ 
    fill: orange; 
} 

:host /deep/ .arc-path{ 
    fill: cornflowerblue; 
    fill-opacity: 0.95; 
    cursor: pointer; 
} 

有使用此技術對角2 d3.js一個question,而這個CSS是去(ViewEncapsulation.None的選擇是不是一種選擇對我來說)的方式。

這些工作正常,但在VS代碼中,CSS文件顯示20錯誤,因爲它不能識別這些CSS組合器。有沒有辦法解決這個問題呢?允許VS Code接受這個語法,或者這是VSCode對我有幫助的突出問題嗎?

+0

https://github.com/angular/angular/commit/b754e60 Angular 4.3.0 now usign :: ng-deep – Ryan

回答

1

我最近遇到了同樣的問題。我沒有解決方案,但他們意識到這一點。希望它很快就會正式解決。

https://github.com/Microsoft/vscode/issues/7002

編輯:現在看來這個問題是固定的。目前我在VS Code version 1.16.1中使用「>>>」和「/ deep /」沒有錯誤。但我個人建議使用「:: ng-deep」,即使所有3個都被棄用(但仍支持Angular)。