Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whats the difference between /deep/ ::ng-deep?

Tags:

css

sass

angular

Could you please tell me, the differences between the below two scss styles? I didn't get the clear idea about this.

:host {
  display: inline-block;

  /deep/ {
    span {
      color: red;
    }
  }
}

:host {
  display: inline-block;

  ::ng-deep {
    span {
      color: red;
    }
  }
}
like image 439
Jeyabalan Thavamani Avatar asked Sep 01 '25 16:09

Jeyabalan Thavamani


1 Answers

The main difference is, that ::ng-deep is supported by SASS, while support for /deep/ was removed. This is the reason why ::ng-deep was added to Angular in addition to /deep/

Besides that, both are deprecated in Angular, because when native shadow DOM support in all browsers becomes usable, they will probably remove ViewEncapsulation.Emulated

like image 172
Günter Zöchbauer Avatar answered Sep 04 '25 07:09

Günter Zöchbauer