Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Incorrect work if move to other component

$
0
0

@KaufmanEndy wrote:

This code not worked
@Component({
selector: ‘default-page’,
templateUrl: ‘./default-page.component.html’,
changeDetection: ChangeDetectionStrategy.OnPush
})

<ion-header>
</ion-header>
<ion-content>
<ng-content></ng-content>
</ion-content>

@Component({
selector: ‘auth-page’,
templateUrl: ‘./auth-page.component.html’,
changeDetection: ChangeDetectionStrategy.OnPush
})

<default-page>
this content hidden
</default-page>

Now i use workaround for correct work :frowning:

@Component({
selector: ‘default-page’,
templateUrl: ‘./default-page.component.html’,
changeDetection: ChangeDetectionStrategy.OnPush
})

@ViewChild(‘workaround’)
workaround: TemplateRef;

<ng-template #workaround>
<ion-header>
</ion-header>
<ion-content>
<ng-content></ng-content>
</ion-content>
</ng-template>

@Component({
selector: ‘auth-page’,
templateUrl: ‘./auth-page.component.html’,
changeDetection: ChangeDetectionStrategy.OnPush
})

<ng-container *ngTemplateOutlet="defaultPage.workaround"></ng-container>
<default-page #defaultPage>
this content hidden
</default-page>

when work with moved to other component begin work correct?
sorry for my english :slight_smile:
if give me work link to template on stackblitz with ionic 4 and angular, i am try write sample code for current problem

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>