Angular 是否从子类向基类模板添加项?
我有一个带有自己模板的基本组件Angular 是否从子类向基类模板添加项?,angular,typescript,Angular,Typescript,我有一个带有自己模板的基本组件 @Component({ selector: 'app-base', templateUrl: './base.html', styleUrls: ['./base.css'] }) export class BaseComponent {} 我想继承基本组件及其html,但是我需要在页面上添加一些不在基本组件上的按钮。我该怎么做 @Component({ selector: 'app-popup', templat
@Component({
selector: 'app-base',
templateUrl: './base.html',
styleUrls: ['./base.css']
})
export class BaseComponent {}
我想继承基本组件及其html,但是我需要在页面上添加一些不在基本组件上的按钮。我该怎么做
@Component({
selector: 'app-popup',
templateUrl: './base.html', <-- Need to add the below buttons to this
<div mat-dialog-actions>
<button mat-raised-button class="btn-primary" (click)="cancel()">Close</button>
</div>
styleUrls: ['./base.css']
})
export class PopupComponent extends BaseComponent {}
@组件({
选择器:“应用程序弹出窗口”,
templateUrl:'./base.html',我从未听说过组件模板中的继承。但您可以创建一个通用模板,它将取决于组件输入。
大概是这样的:
@Component({
selector: 'app-popup',
templateUrl: './base.html', <-- Need to add the below buttons to this
<div mat-dialog-actions>
<button mat-raised-button *ngIf="isCancelEnabled" class="btn-primary" (click)="cancel()">Close</button>
</div>
styleUrls: ['./base.css']
})
export class PopupComponent extends BaseComponent {
@Input() isCancelEnabled: boolean = false;
}
@组件({
选择器:“应用程序弹出窗口”,
templateUrl:“./base.html”,