我有一个指令想要添加到div中,但前提是用户在特定的页面上。下面的代码显示了该指令,但我希望仅当该页面如第二个代码片段中所示时才添加它-我有一个变量selectedSection,它将为我提供用户所在的页面
//我的html代码
<div class="dynamic-tabs" prompt="manage">
//我的伪代码
if (selectedSection == 'admin') then add the 'prompt="manage" directive
发布于 2017-09-06 19:21:45
*ngIf条件呢?(或ng-如果角度为1)
<div class="dynamic-tabs" prompt="manage" *ngIf="selectedSection === 'admin'"> </div>
<div class="dynamic-tabs" *ngIf="selectedSection !== 'admin'"> </div>https://stackoverflow.com/questions/46073873
复制相似问题