【发布时间】:2018-03-02 18:15:35
【问题描述】:
我正在尝试删除导航栏NavBar Pic 上的联系人按钮。我已经尝试了我所知道的一切并且被卡住了。我是 Angular/Typescript 的新手,因此我们将不胜感激。下面列出的代码来自contacts.components.ts 文件。另外,我浏览了 navbar.component.html 页面,其中没有提到任何地方的联系人。
来自 contacts.components.ts 文件:
import { IProductConfig } from 'app/interfaces/interfaces';
import { BaseComponent } from './../base.component';
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-contacts',
templateUrl: './contacts.component.html',
styleUrls: ['./contacts.component.css']
})
export class ContactsComponent extends BaseComponent implements OnInit {
productOptions: IProductConfig;
queryUrl: String;
getContactsContentViewFields: JSON;
ngOnInit() {
this.productOptions = this.product_config
this.getContactsContentViewFields = JSON.parse(`{
"Description" : {"title":"", "type":"string"}
}`);
}
}
来自 navbar.component.html
<ul class="nav">
<li *ngFor="let level1Item of sidebarLinks"
routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
<a *ngIf="level1Item.Href" [href]="level1Item.Href" [attr.data-
toggle]="level1Item?.children?.length > 0 ? 'collapse': null"
[attr.aria-expanded]="(level1Item.isExpanded == true) ? 'true' :
'false'" [attr.target]="level1Item?.OpenInNewTab ? '_blank': '_blank'">
<!--<i class="material-icons" *ngIf="level1Item.TabIcon"
routerLinkActive="white-text">{{level1Item?.TabIcon}}</i>
<i class="material-icons" *ngIf="!level1Item.TabIcon"
routerLinkActive="white-text" style="visibility:hidden
!important;">stop</i>-->
<p>{{level1Item.Level1Title}}
<b *ngIf="level1Item?.children?.length > 0" class="caret"></b>
</p>
</a>
【问题讨论】:
-
基于什么,你想限制?
-
不清楚在什么条件下要限制联系组件。你想禁用点击它还是什么?
-
我想完全移除按钮。
标签: angular typescript components navbar