Project

General

Profile

« Previous | Next » 

Revision 54074

Scroll into view in ngOnInit() for every page.

View differences:

entities.component.ts
1
import { Component, ViewChild, OnInit } from '@angular/core';
1
import { Component, ViewChild, OnInit, ElementRef } from '@angular/core';
2 2
import { ActivatedRoute, Router } from "@angular/router";
3 3
import { HelpContentService } from "../../services/help-content.service";
4 4
import { FormGroup } from "@angular/forms";
......
62 62
           this.properties = data.envSpecific;
63 63

  
64 64
           this.route.queryParams.subscribe(params => {
65
             this.scroll();
66

  
65 67
             this.selectedCommunityPid = params['communityId'];
66 68
             this.applyCommunityFilter(this.selectedCommunityPid);
67 69
             this.isPortalAdministrator = Session.isPortalAdministrator();
......
70 72

  
71 73
    }
72 74

  
73
    constructor(private route: ActivatedRoute, private _router: Router, private _helpContentService: HelpContentService) {}
75
    constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router, private _helpContentService: HelpContentService) {}
74 76
    getEntities(community_pid: string) {
75 77
      if(!Session.isLoggedIn()){
76 78
        console.info(this._router.url);
......
324 326
      }
325 327
    }
326 328

  
329
    public scroll() {
330
      console.info("scroll into view");
331
      if (typeof document !== 'undefined') {
332
         this.element.nativeElement.scrollIntoView();
333
      }
334
    }
335

  
327 336
  }

Also available in: Unified diff