我正在使用Ionic 3. *,创建一个只包含一个按钮的组件。“ion-button + icon-only”内部组件不能正常工作
分量代码是:
@Component({
selector: 'profile-button',
templateUrl: 'profile-button.html',
})
export class ProfileButtonComponent {
constructor(
private popoverCtrl: PopoverController
) {}
/**
* Present the Profile popover
* @param ev
* @returns {Promise<any>}
*/
async presentPopover(ev) {
let popover = this.popoverCtrl.create(ProfilePopover);
return popover.present({
ev
});
}
}
和我的模板是:
<button ion-button icon-only (click)="presentPopover($event)" title="Profile">
<ion-icon name="person"></ion-icon>
</button>
问题:
的问题是,icon-only
指令不理。该按钮仍具有背景色。 如果我将模板放在组件外部,它会显示正确的样式。
看起来指令在组件内不可用。我的组件位于自定义模块内,而不在AppModule上。
我该如何解决这个问题?发现在Ionic2上我需要手动导入指令,但它不适用于Ionic3。
但它不是离子含量。它用于标题,将其包裹在离子内容中会打破风格。 –