Cannot select nested component style angular 7
up vote
1
down vote
favorite
In my old scss style, i used ng-deep
to select style in the nested component but after I moved from angular 5 to 7. This style does not work any longer, I try to find out why but I didn't see any changes, or notes on that except the ng-deep
is depreciate. What under the hood which has changed that could cause this?
I read this https://blog.angular-university.io/angular-host-context/, and I think I understand how it works but I can't put the two together to formulate why. Thanks in advance.
I want to use the style encapsulation, to avoid styles leak to other component.
bootstrap 4 + ngb-bootstrap 4.
index.html
<ngb-modal-window role="dialog" tabindex="-1" class="modal fade show d-block">
<div role="document" class="modal-dialog">
<div class="modal-content">
<div _ngcontent-c5="" class="modal-body">
<hello-world _ngcontent-c5="" _nghost-c6="">
<div _ngcontent-c6="" class="target"></div>
</hello-world></div>
<div _ngcontent-c5="" class="modal-footer">
<button _ngcontent-c5="" class="btn">Close</button>
</div>
</div>
</div>
</ngb-modal-window>
index.scss
:ng-deep .modal-body {
.target {
width: 100px;
height: 100px;
background: red;
}
}
After I updated to angular 7, the above code doesn't work any longer. Instead I have to write my code this way to get access to ngb-modal.
index.scss
:ng-deep .modal { // select the top level style
// index style
// able to style modal
// but unable to select the .target style
}
// below style does not work
:host:ng-deep .modal-body {
.target {
//style
}
}
angular angular-components ng-bootstrap angular7
add a comment |
up vote
1
down vote
favorite
In my old scss style, i used ng-deep
to select style in the nested component but after I moved from angular 5 to 7. This style does not work any longer, I try to find out why but I didn't see any changes, or notes on that except the ng-deep
is depreciate. What under the hood which has changed that could cause this?
I read this https://blog.angular-university.io/angular-host-context/, and I think I understand how it works but I can't put the two together to formulate why. Thanks in advance.
I want to use the style encapsulation, to avoid styles leak to other component.
bootstrap 4 + ngb-bootstrap 4.
index.html
<ngb-modal-window role="dialog" tabindex="-1" class="modal fade show d-block">
<div role="document" class="modal-dialog">
<div class="modal-content">
<div _ngcontent-c5="" class="modal-body">
<hello-world _ngcontent-c5="" _nghost-c6="">
<div _ngcontent-c6="" class="target"></div>
</hello-world></div>
<div _ngcontent-c5="" class="modal-footer">
<button _ngcontent-c5="" class="btn">Close</button>
</div>
</div>
</div>
</ngb-modal-window>
index.scss
:ng-deep .modal-body {
.target {
width: 100px;
height: 100px;
background: red;
}
}
After I updated to angular 7, the above code doesn't work any longer. Instead I have to write my code this way to get access to ngb-modal.
index.scss
:ng-deep .modal { // select the top level style
// index style
// able to style modal
// but unable to select the .target style
}
// below style does not work
:host:ng-deep .modal-body {
.target {
//style
}
}
angular angular-components ng-bootstrap angular7
Did you try/deep/ .modal-body
?
– Enve
Nov 24 at 12:34
Possible duplicate of Alternative of /deep/ in Angular 6
– smnbbrv
Nov 24 at 12:59
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
In my old scss style, i used ng-deep
to select style in the nested component but after I moved from angular 5 to 7. This style does not work any longer, I try to find out why but I didn't see any changes, or notes on that except the ng-deep
is depreciate. What under the hood which has changed that could cause this?
I read this https://blog.angular-university.io/angular-host-context/, and I think I understand how it works but I can't put the two together to formulate why. Thanks in advance.
I want to use the style encapsulation, to avoid styles leak to other component.
bootstrap 4 + ngb-bootstrap 4.
index.html
<ngb-modal-window role="dialog" tabindex="-1" class="modal fade show d-block">
<div role="document" class="modal-dialog">
<div class="modal-content">
<div _ngcontent-c5="" class="modal-body">
<hello-world _ngcontent-c5="" _nghost-c6="">
<div _ngcontent-c6="" class="target"></div>
</hello-world></div>
<div _ngcontent-c5="" class="modal-footer">
<button _ngcontent-c5="" class="btn">Close</button>
</div>
</div>
</div>
</ngb-modal-window>
index.scss
:ng-deep .modal-body {
.target {
width: 100px;
height: 100px;
background: red;
}
}
After I updated to angular 7, the above code doesn't work any longer. Instead I have to write my code this way to get access to ngb-modal.
index.scss
:ng-deep .modal { // select the top level style
// index style
// able to style modal
// but unable to select the .target style
}
// below style does not work
:host:ng-deep .modal-body {
.target {
//style
}
}
angular angular-components ng-bootstrap angular7
In my old scss style, i used ng-deep
to select style in the nested component but after I moved from angular 5 to 7. This style does not work any longer, I try to find out why but I didn't see any changes, or notes on that except the ng-deep
is depreciate. What under the hood which has changed that could cause this?
I read this https://blog.angular-university.io/angular-host-context/, and I think I understand how it works but I can't put the two together to formulate why. Thanks in advance.
I want to use the style encapsulation, to avoid styles leak to other component.
bootstrap 4 + ngb-bootstrap 4.
index.html
<ngb-modal-window role="dialog" tabindex="-1" class="modal fade show d-block">
<div role="document" class="modal-dialog">
<div class="modal-content">
<div _ngcontent-c5="" class="modal-body">
<hello-world _ngcontent-c5="" _nghost-c6="">
<div _ngcontent-c6="" class="target"></div>
</hello-world></div>
<div _ngcontent-c5="" class="modal-footer">
<button _ngcontent-c5="" class="btn">Close</button>
</div>
</div>
</div>
</ngb-modal-window>
index.scss
:ng-deep .modal-body {
.target {
width: 100px;
height: 100px;
background: red;
}
}
After I updated to angular 7, the above code doesn't work any longer. Instead I have to write my code this way to get access to ngb-modal.
index.scss
:ng-deep .modal { // select the top level style
// index style
// able to style modal
// but unable to select the .target style
}
// below style does not work
:host:ng-deep .modal-body {
.target {
//style
}
}
angular angular-components ng-bootstrap angular7
angular angular-components ng-bootstrap angular7
edited Nov 24 at 15:32
asked Nov 13 at 9:41
MayField
325315
325315
Did you try/deep/ .modal-body
?
– Enve
Nov 24 at 12:34
Possible duplicate of Alternative of /deep/ in Angular 6
– smnbbrv
Nov 24 at 12:59
add a comment |
Did you try/deep/ .modal-body
?
– Enve
Nov 24 at 12:34
Possible duplicate of Alternative of /deep/ in Angular 6
– smnbbrv
Nov 24 at 12:59
Did you try
/deep/ .modal-body
?– Enve
Nov 24 at 12:34
Did you try
/deep/ .modal-body
?– Enve
Nov 24 at 12:34
Possible duplicate of Alternative of /deep/ in Angular 6
– smnbbrv
Nov 24 at 12:59
Possible duplicate of Alternative of /deep/ in Angular 6
– smnbbrv
Nov 24 at 12:59
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53278024%2fcannot-select-nested-component-style-angular-7%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you try
/deep/ .modal-body
?– Enve
Nov 24 at 12:34
Possible duplicate of Alternative of /deep/ in Angular 6
– smnbbrv
Nov 24 at 12:59