小编Les*_*oer的帖子

Angular 2 [style.margin-top]

我需要获得img的高度,然后margin-top从img的高度中减去.我在下面尝试了这个代码,但遗憾的是这不起作用

<img [style.marginTop.px]="marginTop - '[style.height.px]' "class="noteImg">
Run Code Online (Sandbox Code Playgroud)

多么优雅解决这个问题?我很高兴你的任何建议.

完整代码

<div class="container-fluid noteContainer" *ngFor="let data of dataPost; let i = index">
    <div class="noteWrapperImg">
        <img [style.marginTop.px]="HOW TO DO IT?" src="{{data?.image}}" class="noteImg" alt="{{data?.altImage}}">
        <a class="{{i%2 == 1 ? 'notePDataNotEven': 'notePDataEven'}}" [class.css]="i%2 == 1">
           <i class="ion-ios-clock-outline"></i> {{data?.data}}
        </a>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

angular

6
推荐指数
1
解决办法
2万
查看次数

SEO的2个通用或prerender.io优化

我想为搜索引擎优化我的网站.我用两种方式搜索了这个.

1路

使用angular 2 universal在服务器端渲染站点.我想这有点困难,我还没有学到这一点.

2种方法

使用https://prerender.io/.我想这很简单.

所以我的问题.什么用于搜索引擎优化它会更友好的搜索引擎和简单?有没有理由使用角度通用或https://prerender.io/就足够了?

对于不正确的问题可能感到抱歉,但我是新手,我想选择更好的方式.

angular-universal angular

6
推荐指数
0
解决办法
674
查看次数

延迟组件的html angular 2

我想做这样的事情。当组件加载后,在1秒钟后加载它的html。这是代码成分(ts)。

import { Component } from '@angular/core';

@Component({
   selector: 'pagination',
   templateUrl: './app/html/pagination.component.html',
   styleUrls: ['app/css/pagination.component.css']
})

export class Pagination {}
Run Code Online (Sandbox Code Playgroud)

我们在代码中看到templateUrl: './app/html/pagination.component.html',1秒后如何加载?总的来说,我的想法包括在服务器上执行发布请求时,向用户显示一个延迟(1秒)的负载。有任何想法吗?

angular

1
推荐指数
1
解决办法
7087
查看次数

标签 统计

angular ×3

angular-universal ×1