You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

RxLet指令rxLetSuspenseTrigger绑定报错,是否缺少导入?

解决方案:RxLet suspenseTrigger 属性绑定错误

错误原因

你遇到的问题源于混用*rxLet结构指令语法与独立属性绑定写法,同时需确认参数别名的正确性:

  1. *rxLet是结构指令的语法糖,应用后无法再通过[rxLetSuspenseTrigger]单独绑定输入属性
  2. 结构指令语法中,suspense触发器的参数别名为suspenseTrg,对应完整属性名rxLetSuspenseTrigger

正确写法示例

写法1:推荐使用结构指令语法(整合所有参数)

将suspenseTrg参数直接写在*rxLet表达式中,无需额外添加属性绑定:

<section id="search-modal">
    <ng-container
        *rxLet="content$; let contents; suspense: suspense; suspenseTrg: query$"
    >
      <div class="content" [style]="size$ | async">
          <img
              *ngFor="let content of contents"
              smartImg
              [src]="content.poster"
              [resolution]="2"
              [viewMovie]="{ id: content.tmdb_id, type: content.type_ }"
        />
      </div>
    </ng-container>

    <ng-template #suspense class="container center">
        <div class="loader center"></div>
    </ng-template>
</section>

写法2:完整属性绑定写法(不使用语法糖)

若要使用独立属性绑定,需去掉*前缀,改用[rxLet]绑定数据流,同时设置其他输入属性:

<section id="search-modal">
    <ng-container
        [rxLet]="content$"
        let-contents
        [rxLetSuspense]="suspense"
        [rxLetSuspenseTrigger]="query$"
    >
      <div class="content" [style]="size$ | async">
          <img
              *ngFor="let content of contents"
              smartImg
              [src]="content.poster"
              [resolution]="2"
              [viewMovie]="{ id: content.tmdb_id, type: content.type_ }"
        />
      </div>
    </ng-container>

    <ng-template #suspense class="container center">
        <div class="loader center"></div>
    </ng-template>
</section>

额外说明

  • 你已正确导入RxLet模块,无需额外添加依赖
  • @rx-angular/template@16.1.1版本完全支持suspenseTrigger特性,只需保证写法符合指令规范

内容的提问来源于stack exchange,提问作者PiwiTheKiwi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 22:06:03