NgFor元素无法在Safari和iOS浏览器中呈现(Angular)

时间:2017-12-19 23:20:54

标签: html arrays angular typescript cross-browser

浏览器未正确呈现ngFor元素,只显示少数元素。如您所见,我有所需的polyfill。在桌面或iOS上的Safari中仍然无法正常工作

请参阅live website

以下是代码:

home.component.ts

this.feedservice.getFeedContent2(this.feedUrl)
.subscribe(
feed =>{
  if (this.notrumpcookie == 'yes'){
  this.field = feed.items.filter(feed=> feed.content.indexOf(substring) !== -1) 
  this.trumpContent = feed.items.filter(item=> this.field.indexOf(item) < 0) 
  this.feeds = this.trumpContent;
  }else if(this.sometrumpcookie == 'yes'){
    this.small = feed.items.filter(feed=> feed.title.indexOf(substring) !== -1) 
  this.trumpTitle = feed.items.filter(item=> this.small.indexOf(item) < 0)
  this.feeds = this.trumpTitle;
}else{
  this.feeds = feed.items;
}

},
 error => console.log(error));
}

home.component.html

 <app-feed-card2 *ngFor="let feed of feeds2 | slice:1:2" [feed]="feed" 
></app-feed-card2>
<h1> TOP STORIES </h1>
<div class="jumbotron">
<app-feed-card *ngFor="let feed of feeds" [feed]="feed" ></app-feed-card>
</div>
<div id="fries"></div>
<trump-slider></trump-slider>

的index.html

<!DOCTYPE html>
<html>

<head>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~locale.en"></script>

polyfill.ts

import 'core-js/es7/reflect';

import 'zone.js/dist/zone';
import 'zone.js/dist/long-stack-trace-zone';
import 'intl';
import 'intl/locale-data/jsonp/en';

safari中home.component的视图: safariview

chrome中的home.component视图: viewchrome

我的角度版本是最新的5.1.1,我也有一个开放的github Issue

1 个答案:

答案 0 :(得分:0)

如果有人在将来遇到这种情况,那么问题就是第三方管道搞砸了这个观点。