需要页面滚动数据加载器

时间:2018-03-23 08:45:48

标签: ruby-on-rails angular

我正在开发一款可以充当社交媒体的应用。我正在使用技术Angular 4和Backend RubyonRails。

我需要一个数据加载器。页面上第一次加载15张帖子显示在页面上。用户向下滚动5个以上的帖子来自底部,前5个帖子隐藏。

this.zone.run(() =>{
  this.postservice.doAllPost(this.globalService.user_token).subscribe((response: any) => {
    this.allPosts = response.posts;
    for (let post of this.allPosts){
      this.formPostObject = this.fb.group({
        post_text : new FormControl(post.post_text, Validators.compose([Validators.required])),
        id : new FormControl(post.id),
      });

      this.formPostCollection.push(this.formPostObject);
    }
    this.loading = false;
  });
});

这是我的帖子数据代码。

谢谢, 拉胡

0 个答案:

没有答案