小编Kac*_*ela的帖子

Angular 5 ng-select如何将两个值添加到“ bindLabel”?

我想在属性bindLabel中有两个值的ng-select。我有这样的事情:

<ng-select placeholder="{{'TASKS.FOR_WHO' | translate }}"
                           name="users"  [items]="users" bindLabel="firstName" >

 </ng-select>
Run Code Online (Sandbox Code Playgroud)

但是在绑定标签中,我想让bindLabel = firstName + lastName。像这样:

<ng-select placeholder="{{'TASKS.FOR_WHO' | translate }}"
                           name="users"  [items]="users" bindLabel="firstName+lastName">

 </ng-select>
Run Code Online (Sandbox Code Playgroud)

如何实现呢?

angular-ngselect angular

7
推荐指数
3
解决办法
6918
查看次数

Angular 6,ngStyle 指令中 css 文件的颜色

我想使用我的ngStyle指令(在 HTML 中)的 CSS 文件中定义的颜色。

这是我在 HTML 中得到的内容:

 [ngStyle]="{backgroundColor: isDarkStyle() ? '#29434e' : isNormalStyle() ? '#cfd8dc' : isLightStyle() ? 'white': ''}"
Run Code Online (Sandbox Code Playgroud)

这是我的带有颜色的 CSS 文件:

//colors for background

$light-background: white;
$normal-background: #cfd8dc;
$dark-background: #29434e;
Run Code Online (Sandbox Code Playgroud)

但我想要这个:

[ngStyle]="{backgroundColor: isDarkStyle() ? '$dark-background' : isNormalStyle() ? '$normal-background' : isLightStyle() ? '$light-background': ''}"
Run Code Online (Sandbox Code Playgroud)

我怎样才能达到这个结果?感谢帮助 :)

html css ng-style angular

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

angular ×2

angular-ngselect ×1

css ×1

html ×1

ng-style ×1