an angular portlet changes the scroll location

  angular, liferay

I have a weird issue, I add a component for dropdown button, which is get checked by the use.
My environment is an angular 5 module, on a Liferay 7.0.

So when someone changes the location, and it gets saved in the cookie, next browse to the page goes to the location where the dropdown button located, if the cookie is not set, so the page take the right position.

Here is the code :

<fieldset>
<div class="row location-dropdown">  
  <label class="col-sm-2 col-form-label" for="location-selector" i18n="@@lnkShowEventsFor.label">Show events for: </label>
  <select class="col-sm-2 form-control-static" [ngModel]="selectedLocation"  aria-labelledby="dropdownMenuButton" name="location-selector" (ngModelChange)="onChangeObj($event)" >
     <option [ngValue]="null" i18n="@@lnkAllLocation.label">All locations</option>
     <option [ngValue]="value" *ngFor="let value of values|slice:0:end" >{{value}}</option>
  </select>
</div>
  <ng-container *ngIf="isShowMore()">
    <div class="arena-facet-show-all">
      <a class="arena-show-all" href="javascript:" (click)="showMore()" title="Show all" i18n="@@lnkShowAllLocations.label" i18n-title="@@lnkShowAllLocations.title">
        Show all
      </a>
    </div>
  </ng-container>
ngOnInit() {
    const subscription: Subscription = this.route.queryParams.subscribe(
        queryParams => {
            const urlTree = this.router.createUrlTree(['/'], {queryParams: queryParams});
            this.allEventsUrl = this.calendarEventListConfig.getAllEventsUrl() + '#' + this.serializer.serialize(urlTree);
        },
        (error: any) => console.error(error),
        () => subscription.unsubscribe());
}

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.