Угловой ngIf не работает внутри ng-шаблона - PullRequest
0 голосов
/ 11 июля 2019

Привет, я использую этот плагин nativescript:

https://github.com/triniwiz/nativescript-accordion

У меня есть следующий код:

<StackLayout>
  <Accordion height="100%" [items]="items" allowMultiple="false" [selectedIndexes]="selectedIndexes">
    <ng-template let-i="index" let-item="item" acTemplateKey="title">
      <Label [text]="item.header"></Label>
    </ng-template>

    <ng-template let-i="index" let-item="item" acTemplateKey="content">
      <ng-container *ngIf="item.type === 'product-wallet'">
        <Label text="WAHAHAHA"></Label>
      </ng-container>
      <!-- <app-product-transfer *ngIf="item.type === 'product-wallet'"></app-product-transfer> -->
    </ng-template>
  </Accordion>
</StackLayout>

Этот шаблон выдает ошибку:

ОШИБКА КОНСОЛИ [собственный код]: ОШИБКА TypeError: undefined не является объект (оценивает 'newIndexes.length') ОШИБКА КОНСОЛИ [собственный код]: ОШИБКА КОНТЕКСТА {"view": {"def": {"nodeFlags": 639027201, «rootNodeFlags»: 1, «nodeMatchedQueries»: 2, «flags»: 0, «node»: [{ "nodeIndex": 0, "parent": null, "renderParent": null, "bindingIndex": 0, «outputIndex»: 0, «checkIndex»: 0, «flags»: 1, «childFlags»: 639027201, "directChildFlags": 33554433, "childMatchedQueries": 2, "matchedQueries": {}, "matchedQueryIds": 0, "ссылки": {}, "ngContentIndex": null, "childCount": 8, "bindings": [], "bindingFlags": 0, "output": [], "element": {"ns": "", "name": "StackLayout", "attrs": [], "template": null, "componentProvider": null, "componentView": null, "componentRendererType": null, "publicProvider <…> NativeScript поймал сигнал 11. Собственный стек: 1
0x10f2d81df sig_handler (int) 2 0x112f16b5d _sigtramp 3 0x1240cba00 4 0x113c7db65 - [UITableView _createPreparedCellForGlobalRow: willDisplay:] 5 0x113cad363 - [_ UITableViewUpdateSupport (частное) _setupAnimationsForNewlyInsertedCells] 6 0x113cb726b - [_ UITableViewUpdateSupport _setupAnimations] 7 0x113c4b610 - [UITableView _updateWithItems: updateSupport:] 8 0x113c431f5 - [UITableView _endCellAnimationsWithContext:] 9 0x113c5c571 - [UITableView _updateSections: withUpdateAction: rowAnimation : headerFooterOnly: usingPresentationValues:] 10 0x113c5c99c - [UITableView reloadSections: withRowAnimation:] 11 0x14132d676 - [UITableViewAccessibility reloadSections: withRowAnimation:] 12 0x10fbf451d ffi_call_unix64 13 0x126482db0 Стек JS: 1 reloadSectionsWithRowAnimation @ [собственный код] 2 reloadSection @ file: ///app/vendor.js: 123034: 49 3
handleTap @ file: ///app/vendor.js: 123077: 26 4
tableViewWillSelectRowAtIndexPath @ file: ///app/vendor.js: 122990: 22 5
UIApplicationMain @ [собственный код] 6
start @ file: ///app/vendor.js: 149361: 26 7
запустите @ file: ///app/vendor.js: 149389: 10 8
bootstrapNativeScriptApp @ file: ///app/vendor.js: 125890: 26 9
bootstrapApp @ file: ///app/vendor.js: 125791: 38 10 bootstrapModule @ file: ///app/vendor.js: 125775: 26 11 @file: ///app/bundle.js: 8255: 144 12 ./main.ts@file:///app/bundle.js:8260:34 13 webpack_require @ file: ///app/bundle.js: 752: 34 14 checkDeferredModules @ file: ///app/bundle.js: 45: 42 15 @file: ///app/bundle.js: 828: 38 16 анонимный @ file: ///app/bundle.js: 829: 12 17 оценивать @ [собственный код] 18 moduleEvaluation @: 1: 11 19 обещание_реакции @: 1: 11 20 требуется @ [собственный код] 21 анонимный @ файл: ///app/starter.js: 2: 8 22 оценивать @ [собственный код] 23 moduleEvaluation @: 1: 11 24 promiseReactionJob @: 1: 11

Но когда я пытался удалить ng, если все работает. Почему это так?

Спасибо!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...