<page [pagetitle]="pagePath">
<content>
<section title="Landlords" [isExpanded]="sectionExpansionStatus[0].isExpanded" (onSectionExpandChange)="onSectionExpandChange($event)">
<landlord-list [categorytype]=1 *ngIf="sectionExpansionStatus[0].isExpanded"></landlord-list>
</section>
<section title="Tenants" [isExpanded]="sectionExpansionStatus[1].isExpanded" (onSectionExpandChange)="onSectionExpandChange($event)">
<landlord-list [categorytype]=2 *ngIf="sectionExpansionStatus[1].isExpanded"></landlord-list>
</section>
<section title="Additional Data Field">
<additional-datafields [addlDataFieldCategoryId]="30"></additional-datafields>
</section>
</content>
我可以從我的組件這樣的訪問此「categorytype」。
if (contextObj.categorytype == 1)
{
//write code here
}
如果我想傳遞categorytype作爲字符串..我該怎麼做?我如何從組件訪問?
mmmm contextObj.category.toString()比聲明變量兩次轉換爲字符串容易得多。 – btinoco
@ btinoco感謝提醒,然而重點是顯示轉換不是聲明 – Yaser