diff --git a/src/app/components/avatar/avatar.css b/src/app/components/avatar/avatar.css index 551dff78fcf..e5850559f60 100755 --- a/src/app/components/avatar/avatar.css +++ b/src/app/components/avatar/avatar.css @@ -1,4 +1,7 @@ @layer primeng { + .p-avatar-host{ + display: inline-flex; + } .p-avatar { display: inline-flex; align-items: center; diff --git a/src/app/components/avatar/avatar.ts b/src/app/components/avatar/avatar.ts index a88c95f31a8..bd3ebd985a9 100755 --- a/src/app/components/avatar/avatar.ts +++ b/src/app/components/avatar/avatar.ts @@ -9,16 +9,16 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, NgModule, Outp template: `
- {{ label }} - - + {{ label }} + +
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, styleUrls: ['./avatar.css'], host: { - class: 'p-element' + class: 'p-avatar-host p-element' } }) export class Avatar { @@ -87,6 +87,12 @@ export class Avatar { imageError(event: Event) { this.onImageError.emit(event); } + + get labelStyle(){ + return { + 'position': this.image ? 'absolute' : undefined + } + } } @NgModule({ diff --git a/src/app/showcase/doc/avatar/imagedoc.ts b/src/app/showcase/doc/avatar/imagedoc.ts index fe9b42a023f..9a95b5d401e 100644 --- a/src/app/showcase/doc/avatar/imagedoc.ts +++ b/src/app/showcase/doc/avatar/imagedoc.ts @@ -22,6 +22,10 @@ import { Code } from '@domain/code';
Gravatar
+
+
Image with Label
+ +
@@ -29,66 +33,81 @@ import { Code } from '@domain/code'; }) export class ImageDoc { code: Code = { - basic: ` - - - -`, + + +`, html: `
- - -
Badge
-
Gravatar
-
+
+
Image with Label
+ +
`, typescript: `import { Component } from '@angular/core';