Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't render correctly when its loaded with [hidden] #202

Closed
cerkiner opened this issue Oct 12, 2017 · 4 comments
Closed

Doesn't render correctly when its loaded with [hidden] #202

cerkiner opened this issue Oct 12, 2017 · 4 comments

Comments

@cerkiner
Copy link

On my use case, I need it to appear on certain event triggers, I am using [hidden] to render and load the events on page load and then I am programmatically making it visible when it is necessary. When it is visible the swipe, click and tap don't work and the styles are not the same with initially loaded version.

@twinssbc
Copy link
Owner

@cerkiner I think you need to use *ngIf instead of [hidden]. hidden attribute basically just adds the display:none to the DOM elements so the elements actually already exist. But I guess the underlying Swiper control needs to do some calculation for the DOM element width and offset, so it can't get proper result using the hidden elements. While ngIf generates the DOM elements completely, so no such issue.

@shalini-github
Copy link

hi @twinssbc I am using [ngIf]="uploadEvent == 'yes'" condition on ng-template. the calendar is not loading with day events. it loads if i remove ngIf condition.

@twinssbc
Copy link
Owner

@shalini-github if that's the case, I think it's related to your ngIf condition, uploadEvent == 'yes'.

@shalini-github
Copy link

shalini-github commented Jul 29, 2020

I have two div elements one with calendar, ng-template. other one with some labels. ngIf condition is simple and the calendar div comes blank when i click on the segmentbutton. not sure what i'm missing here. please see my below sample code and screenshot

<ion-segment (ionChange)="segmentChanged()" [(ngModel)]="uploadEvent">
      <ion-segment-button value="yes">
        <ion-label>Events</ion-label>
      </ion-segment-button>
      <ion-segment-button value="no">
        <ion-label>Contact US</ion-label>
      </ion-segment-button>
    </ion-segment>

<ion-content #bodyElement id="contentC" class="content-bg">
  <div *ngIf="uploadEvent == 'yes'">
  <ng-template  #template let-displayEvent="displayEvent">
       <ion-row>
        <ion-col col-2>
          <div>Event {{displayEvent.event.title}}</div>
        </ion-col>
      </ion-row>
  </ng-template>

  <calendar [eventSource]="eventSource" [dayviewNormalEventTemplate]="template" [calendarMode]="calendar.mode" [currentDate]="calendar.currentDate"
    (onEventSelected)="onEventSelected($event)" (onTitleChanged)="onViewTitleChanged($event)" (onTimeSelected)="onTimeSelected($event)"
    startHour="5" endHour="24" [scrollToHour]="calendar.scrollToHour" [preserveScrollPosition]="true" [locale]="calendar.locale">
  </calendar>
</div>
  <div *ngIf="uploadEvent == 'no'">
                <label text-wrap class="destination">{{location}}</label>
                <label text-wrap class="address">{{adderss}}</label>
  </div>
</ion-content>

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants