如何在不刷新角度的情况下首先加载CSS

时间:2019-02-07 07:08:21

标签: angular

我正在使用此应用程序制作角度博客应用程序,我正在使用角度图像滑块,当在此CSS代码中使用ng-deep时,我希望图像的宽度固定,然后工作,但不刷新未加载CSS的页面。

blog.component.html

    <div class="container">
        <div class="row">

            <div class="col-sm-12">
                <main role="main">
                    <div class="jumbotron" *ngFor="let user of usersBlog" style="margin-top: 50px;">
                        <h2 class="display-3">{{user.title}}</h2>
                        <angular-image-slider *ngIf="user.images" [images]="user.images"></angular-image-slider><br>

                        <p class="new22" style="display:-webkit-inline-flex;font-size: 14px" [innerHTML]="user.blog"></p>
                        <h4 class="ab1">Published By</h4>
                        <h6 class="ab2">{{user.first_name}}  {{user.last_name}}</h6>
                        <h6 class="ab2">{{user.created_at | date:'MM-dd-yyyy '}}</h6>

                    </div>
                </main>
            </div>

        </div>
    </div>

blog.component.css

::ng-deep #grid[_ngcontent-c2] {
  margin-left: -189%;
  width: -170%;
}

::ng-deep.image-cropper[_ngcontent-c2] img[_ngcontent-c2]{
  width: 100% !important;
}

在blog.component.css中,我正在图像滑块上使用此CSS。在第一张图像中,刷新页面时CSS不起作用,刷新页面时显示2张图像。enter image description here

enter image description here

0 个答案:

没有答案