插件未在ngFor direct div Angular 5.2上应用更改

时间:2018-05-29 09:53:39

标签: javascript html angular angular5

我一直在寻找解决方案几天但无法找到有效的解决方案。问题是这个有一个类ish-container-inner的div被链接到一个js插件,它只适用于下面的代码:

<div class="ish-container-inner ish-product">
    <div class="ish-main-content ish-pflo-gal ish-scroll-anim ish-2col ish-square ish-content-parallax">

        <div class="ish-item">
            <div class="ish-item-container">
                <div class="ish-caption-container">
                    <div class="ish-caption">
                        <span class="ish-h4 ish-txt-color9">Special Effects</span> <span class="ish-separator">/</span> <span>Ink</span></div>
                </div>
                <div class="ish-img">
                    <a href="product-detail.html" class="ish-img-scale" style="background-image: url('assets/img/bniinks-003.jpg');"><img src="assets/img/bniinks-003.jpg" alt="Project"></a>
                </div>
            </div>
        </div>

    </div>
</div>

但是,只要我将* ngFor放在下面,它就行不通。即使有ngIf存在:

<div class="ish-container-inner ish-product" *ngIf="products">
    <div class="ish-main-content ish-pflo-gal ish-scroll-anim ish-2col ish-square ish-content-parallax">

        <div class="ish-item" *ngFor="let product of products">
            <div class="ish-item-container">
                <div class="ish-caption-container">
                    <div class="ish-caption">
                        <span class="ish-h4 ish-txt-color7">{{ product.name }}</span> <span class="ish-separator">/</span> <span>Ink</span>
                    </div>
                </div>
                <div class="ish-img">
                    <a href="product-detail.html" class="ish-img-scale" [style.background]="'url('+product.thumbnail+')'">
                        <img src="{{product.thumbnail}}" alt="Project"></a>
                </div>
            </div>
        </div>
    </div>
</div>

此时我在产品中有有效数据,但插件不适用于这些div元素。我不知道为什么。没有ngFor指令。 Div被自动分配了一些样式,这些样式由滚动插件改变,即

<div  class="ish-main-content ish-pflo-gal ish-scroll-anim ish-2col ish-square ish-content-parallax" style="position: relative; height: 629px; margin-top: -99.5455px;" data-initial-top="0">

但是如果我把ngIf或ngFor指令。它不再起作用,并且这些样式不会自动分配。等待回复:)

0 个答案:

没有答案