ng:在一个元素上不能有多个模板绑定。仅使用一个名为template的属性或以*为前缀

时间:2018-05-11 15:03:40

标签: angular angular5

我使用angular5,我无法使用* dropdownMenu和* ngFor,我收到此错误:

ng : Can't have multiple template bindings on one element . Use only one attribute named template or prefixed with *

这是代码:

<div class="btn-group" dropdown>
        <button dropdownToggle type="button" class="btn btn-primary dropdown-toggle" (click)="ListUsers()">
          List of users <span class="caret"></span>
        </button>
        <ul *dropdownMenu class="dropdown-menu" role="menu" *ngFor="let c of listUsers">
          <li role="menuitem"><a class="dropdown-item">{{c.Firstname}} {{c.lastName}}</a></li>
        </ul>
      </div>

我该如何解决这个问题?

0 个答案:

没有答案