我正在尝试使用行为主题在HTML中提供异步管道。该对象在初始加载时起作用,但随后在任何后续尝试更新时都不会注册发射。我无法弄清楚的是,为什么接下来在行为主题上没有从switchMap触发apiCall()。
buy-plans.component.html
int main()
{
FILE* p;
p = fopen("file.txt", "r+");
int i = 0, j, k;
char* pointer, lineRead[20], arr2[20][20];
if (p != NULL)
{
while (!feof(p))
{
fscanf(p, "%s", &lineRead);
for (k = 0; lineRead[k] != '\0'; k++);
pointer = lineRead;
for (j = 0; j < k; j++)
{
arr2[i][j] = *pointer;
pointer++;
}
arr2[i][j] = '\0';
i++;
}
for (int i = 0; i < 4; i++)
{
printf("%s\n", arr2[i]);
}
}
else
{
printf("Couldn't find file.\n");
}
return 0;
}
buyplans.component.ts
<div class="wrapper" *ngIf="buyPlan$ | async as buyPlan; else loading">
<div class="desktop-container" *ngIf="deviceInfoService.isDesktopDevice; else mobileContainer">
<app-buy-plans-desktop [buyPlan]="buyPlan"> </app-buy-plans-desktop>
</div>
<ng-template #mobileContainer>
<app-buy-plans-mobile [buyPlan]="buyPlan"></app-buy-plans-mobile>
</ng-template>
</div>
<ng-template #loading>
<div class="spinner-wrapper" [ngClass]="{ 'sidenav-open': sharedService.isSidenavOpen$ | async }">
<div class="spinner-mask"></div>
<mat-spinner class="buy-plans-spinner" color="accent"></mat-spinner>
</div>
</ng-template>