如何在打字稿中返回ng-select?

问题描述 投票:0回答:1

我正在尝试在打字稿(角度)中添加下拉菜单。但我不确定这是否可能,因为 ng-select 是一个未渲染的组件。我怎样才能做到这一点?

@Component({
  selector: 'app-testing',
  templateUrl: './app-testing.component.html',
  styleUrls: ['./app-testing.component.scss']
})

export class TestCompontnt implements OnInit  {

ngOnInit() {}

example(type: string) {
    return `
        <table class="table table-striped table-bordered table-hover table-checkable middle-align-table">
          <thead>
              <tr>
                  <th style="width: 40%">TT</th>
                  <th>TT2</th>
              </tr>
          </thead>
          <tbody>
              <td>okej</td>
              <td>
                  <div class="input-group">
                      <input type="number" class="form-control">
                      <div class="input-group-append">
                          <ng-select>
                              <ng-option value="TEST">TEST</ng-option>
                          </ng-select>
                      </div>
                  </div>
              </td>
          </tbody>
      </table>
    `;
  }
}

我尝试向动态组件添加下拉菜单。

angular typescript ng
1个回答
0
投票

Angular 中没有像

<ng-select>
这样的组件,没有第三方依赖。您可以使用 HTML 中的原生
select
option
元素。

<select>
  <option value="TEST">TEST</option>
</select>
© www.soinside.com 2019 - 2024. All rights reserved.