Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

el-table-column > ng-template中*ngIf部分情况不生效 #50

Closed
3 tasks
yinjs opened this issue Mar 9, 2018 · 4 comments
Closed
3 tasks

el-table-column > ng-template中*ngIf部分情况不生效 #50

yinjs opened this issue Mar 9, 2018 · 4 comments

Comments

@yinjs
Copy link
Contributor

yinjs commented Mar 9, 2018

Issue Type:

  • Bug
  • Feature
  • Help

Version & Environment:
0.6.3

Description:
el-table-column > ng-template中ngIf如果引用了之前column中没出现过的model key总是判断为ngIf="false"

以下例子中的Block/Unblock button无法正常切换

<el-table class="app-list-content-table" *ngIf="companyList" [model]="companyList.elements">

<ng-template #slot let-scope="scope">
<el-checkbox [model]="selection[scope.rowData.id]" (modelChange)="handleRowSelection($event, scope.rowData.id)">







<ng-template #slot let-scope="scope">

<a [routerLink]="['/companies', scope.rowData.id]" routerLinkActive="active">View

<el-button type="text" size="small" *ngIf="scope.rowData?.blocked" (click)="setBlock(scope.rowData.id, false)">Unblock
<el-button type="text" size="small" *ngIf="!scope.rowData?.blocked" (click)="setBlock(scope.rowData.blocked, true)">Block


@unix
Copy link
Contributor

unix commented Mar 9, 2018

你这里的代码标签都没有闭合,应该是不能正常工作的。另外请用代码格式贴上代码。

@yinjs
Copy link
Contributor Author

yinjs commented Mar 9, 2018

<el-table class="app-list-content-table" *ngIf="companyList" [model]="companyList.elements"> <el-table-column model-key="id" label="ID" width="300"></el-table-column> <el-table-column model-key="name" label="Name" width="250"></el-table-column> <el-table-column label="Actions" width="120"> <ng-template #slot let-scope="scope"> <el-button type="text" size="small"> <a [routerLink]="['/companies', scope.rowData.id]" routerLinkActive="active">View</a> </el-button> <el-button type="text" size="small" *ngIf="scope.rowData?.blocked" (click)="setBlock(scope.rowData.id, false)">Unblock</el-button> <el-button type="text" size="small" *ngIf="!scope.rowData?.blocked" (click)="setBlock(scope.rowData.blocked, true)">Block</el-button> </ng-template> </el-table-column> </el-table>

@yinjs
Copy link
Contributor Author

yinjs commented Mar 9, 2018

如果在table column中加一列block先把值读出来是有true/false的,最后一列中的ngif也能正常了,但是我不想要显式的出来block列,只是希望在最后一列actions中根据blocked的值切换button

@unix
Copy link
Contributor

unix commented Mar 9, 2018

请注意组织好语言、代码格式等,问题不可读我也不知道你想说什么。
这个 issue 先关闭了,如果你准备好了相关信息请重开一个 issue。
谢谢你的关注。

@unix unix closed this as completed Mar 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants