在我的应用程序中我使用fexbox概念来显示公司名称和材料的headcompany。我在这里使用了ngx-datatable。我将columnmode设置为flex。现在我将每列的flexgrow设置为1.我想为这两列的flex-grow写一个if-else条件。例如,如果按下selectedCompany,则第二列增长为2,否则为1。
<ngx-datatable *ngIf="companies && companies.length" class="material" [scrollbarH]="true" [rows]="companies" [externalPaging]="true" [externalSorting]="true" [count]="companyPage.totalElements" [offset]="companyPage.number" [limit]="companyPage.size"
[columnMode]="'flex'" [footerHeight]="'auto'" [headerHeight]="'auto'" [rowHeight]="'auto'" (page)='onCompanyPageEvent($event)' (sort)='onCompanySortEvent($event)' (activate)="onActivateCompany($event)">
<ngx-datatable-column [prop]="'name'" [flexGrow]="1" >
<ng-template ngx-datatable-header-template >
<span class="ellipsis" title="{{value}}">
{{'A921Name' | translate}}
</span>
</ng-template>
</ngx-datatable-column>
//我试着写if-else here
<ngx-datatable-column [prop]="'parentName'" *ngIf="selectedCompany" [flexGrow]="2" [sortable]="false" >
<ng-template ngx-datatable-header-template>
<span class="ellipsis" title="{{value}}">
{{'A922ParentCompany' | translate}}
</span>
</ng-template>
</ngx-datatable-column>
</ngx-datatable>
答案 0 :(得分:0)
当您使用方括号包装属性时,可以将其设置为动态。这意味着它将在各自的typescript类中查找属性。因此,对于像此处[footerHeight]="'auto'"
那样的静态值,在将footerHeight
设置为字符串'auto'
时,不需要使用方括号括起footerHeight="auto"
。你可以export class RelatedPage {
footerHeightValue: string;
constructor(){
this.footerHeightValue = 'auto';
}
}
。但是,如果您的typescript类中有一个属性,其中包含footerHeight的字符串值,例如:
footerHeight
然后您可以执行动态绑定并将[footerHeight]="footerHeightValue"
设置为相应的属性,如[attribute]
;
因此,当您想要在某个条件语句中更改属性的值时,您希望使属性动态化为flexGrow
。在您的情况下,如果您的<span (click)="titleClicked()">{{companyName}}</span>
属性必须根据标题是否被点击而更改,您可以将tap事件绑定到布尔值。
export class RelatedPage {
titleSelected: boolean;
titleClicked() {
this.titleSelected = true;
}
}
并在你的打字稿类中,
titleSelected
现在,您可以将flexBox
属性与flexBox]="titleSelected ? 2 : 1"
属性绑定,如下所示
[if (titleSelected === true) {
flexBox = 2;
} else {
flexBox = 1;
}
这评估为
@echo off
SET _cliportaskkill=0
SET _startffox=0
If "%_cliportaskkill%"=="2" goto everything
If "%_cliportaskkill%"=="1" goto cliponly
If "%_cliportaskkill%"=="0" goto taskkillonly
:cliponly
echo|set /p=username@email.com|clip
EXIT
:taskkillonly
TASKKILL /F /T /IM Greenshot.exe & TASKKILL /F /T /IM iprntctl.exe & TASKKILL /F /T /IM iprntlgn.exe & TASKKILL /F /T /IM smax4pnp.exe & TASKKILL /F /T /IM ZenNotifyIcon.exe & TASKKILL /F /T /IM ZenUserDaemon.exe & TASKKILL /F /T /IM RAVBg64.exe & TASKKILL /F /T /IM nwtray.exe & TASKKILL /F /T /IM RtkNGUI64.exe & TASKKILL /F /T /IM BingSvc.exe & TASKKILL /F /T /IM Spotify.exe & TASKKILL /F /T /IM SpotifyWebHelper.exe & TASKKILL /F /T /IM FacebookGameroom.exe & TASKKILL /F /T /IM "Facebook Gameroom Browser.exe" & TASKKILL /F /T /IM zapp.exe & TASKKILL /F /T /IM steamwebhelper.exe & TASKKILL /F /T /IM Steam.exe & TASKKILL /F /T /IM lync.exe
EXIT
:everything
echo|set /p=username@email.com|clip
TASKKILL /F /T /IM Greenshot.exe & TASKKILL /F /T /IM iprntctl.exe & TASKKILL /F /T /IM iprntlgn.exe & TASKKILL /F /T /IM smax4pnp.exe & TASKKILL /F /T /IM ZenNotifyIcon.exe & TASKKILL /F /T /IM ZenUserDaemon.exe & TASKKILL /F /T /IM RAVBg64.exe & TASKKILL /F /T /IM nwtray.exe & TASKKILL /F /T /IM RtkNGUI64.exe & TASKKILL /F /T /IM BingSvc.exe & TASKKILL /F /T /IM Spotify.exe & TASKKILL /F /T /IM SpotifyWebHelper.exe & TASKKILL /F /T /IM FacebookGameroom.exe & TASKKILL /F /T /IM "Facebook Gameroom Browser.exe" & TASKKILL /F /T /IM zapp.exe & TASKKILL /F /T /IM steamwebhelper.exe & TASKKILL /F /T /IM Steam.exe & TASKKILL /F /T /IM lync.exe
EXIT
===================================================================================================================
@echo off
If "%_startffox%"=="1" goto newwindow
If "%_startffox%"=="0" goto newtab
:newwindow
CD /D "C:\Program Files (x86)\Mozilla Firefox"
firefox.exe "https://www.outlook.com/" "http://everybodyedits.com/" "http://www.kongregate.com/accounts/username/recently-played"
EXIT
:newtab
CD /D "C:\Program Files (x86)\Mozilla Firefox"
firefox.exe -new-tab "https://www.outlook.com/" -new-tab "http://everybodyedits.com/" -new-tab "http://www.kongregate.com/accounts/username/recently-played"
EXIT