小编Sit*_*ana的帖子

ng-select : 添加一个额外的选项

如何在我的 ng-select 下拉列表中添加一个额外的项目,例如Create New in the following image:

在此处输入图片说明

这是我目前的代码:

<ng-select
    [multiple]="true"
    [hideSelected]="true"
    [items]="robots"
    formControlName="RobotGUID"
    bindLabel="Name"
    bindValue="GUID"
>
    <ng-template ng-label-tmp let-item="item" let-clear="clear">
        <ng-container *ngIf="item.GUID">
            <span class="ng-value-icon left" (click)="onRobotEditClick($event, item.GUID)" aria-hidden="true">
                <i class="fas fa-edit btn-focus"></i>
            </span>
            <span class="ng-value-label">{{item.Name}}</span>
            <span class="ng-value-icon right" (click)="clear(item)" aria-hidden="true">×</span>
        </ng-container>
    </ng-template>
</ng-select>
Run Code Online (Sandbox Code Playgroud)

我尝试使用,<ng-option>但该项目没有出现在下拉列表中。如何从模板中添加额外的项目?

javascript typescript angular-ngselect angular

5
推荐指数
2
解决办法
5565
查看次数

如何根据颤振中的下拉列表添加文本字段值

我还是 Flutter 的新手。在这里我想从下拉列表中选择值到类别表单字段。但是在尝试定义时出现错误

child: DropdownButtonHideUnderline 
Run Code Online (Sandbox Code Playgroud)

在 Textformfield 中。我试图找到一个解决方案,但我找不到它,而且我无法自己编程。我希望你能帮助我。还有其他方法可以存档吗?

在此处输入图片说明

我的代码在这里,提前感谢您的指导。

class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {

 final AuthService _auth = AuthService();
 final _formKey = GlobalKey<FormState>();
 String error = '';
 bool loading = false;
 String name = '';
 String nickname = '';
 String city = '';


 @override
 Widget build(BuildContext context) {
   return Container(
    child: Scaffold(
    backgroundColor: Colors.brown[50],
    appBar: AppBar(
      title: Text('Brew Crew'),
      backgroundColor: Colors.brown[400],
      elevation: 0.0,
      actions: <Widget>[
        FlatButton.icon(
          icon: Icon(Icons.person),
          label: …
Run Code Online (Sandbox Code Playgroud)

forms dropdown flutter

0
推荐指数
1
解决办法
2147
查看次数