无法使用 style、styleClass、inputStyle 或 inputStyleClass Angular-CLI 覆盖 primeNG 中的样式
unable to override styles in primeNG with style, styleClass, inputStyle or inputStyleClass Angular-CLI
我终于能够让 primeNG 与 angular-cli 一起工作。在 `.angular-cli.json 我有:
"styles": [
"../node_modules/primeng/resources/themes/omega/theme.css",
"../node_modules/primeng/resources/primeng.css",
"styles.css"
],
我正在尝试像这样使用 CalendarModule
:
import {CalendarModule} from "primeng/primeng";
@NgModule({
imports: [
CalendarModule
],
在 HTML 我有以下内容:
<p-calendar styleClass="test" [(ngModel)]="validationDate"
inputStyleClass="test" [showIcon]="true" dateFormat="dd.mm.yy"></pcalendar>
组件中css
@Component({
selector: 'user-validation',
templateUrl: 'user-validation.component.html',
styleUrls: ['user-validation.component.css']
})
user-validation.component.css
.test{
width: 25px;
}
尝试
/deep/ .test{
width: 25px !important;
}
或
>>> .test{
width: 25px !important;
}
这对我有用 -
<p-calendar name = "calendarMod" [showIcon]="true" [(ngModel)]="actionDate" dateFormat="mm/dd/yy" [inputStyle] = "{'width':'85px'}" ></p-calendar>
我终于能够让 primeNG 与 angular-cli 一起工作。在 `.angular-cli.json 我有:
"styles": [
"../node_modules/primeng/resources/themes/omega/theme.css",
"../node_modules/primeng/resources/primeng.css",
"styles.css"
],
我正在尝试像这样使用 CalendarModule
:
import {CalendarModule} from "primeng/primeng";
@NgModule({
imports: [
CalendarModule
],
在 HTML 我有以下内容:
<p-calendar styleClass="test" [(ngModel)]="validationDate"
inputStyleClass="test" [showIcon]="true" dateFormat="dd.mm.yy"></pcalendar>
组件中css
@Component({
selector: 'user-validation',
templateUrl: 'user-validation.component.html',
styleUrls: ['user-validation.component.css']
})
user-validation.component.css
.test{
width: 25px;
}
尝试
/deep/ .test{
width: 25px !important;
}
或
>>> .test{
width: 25px !important;
}
这对我有用 -
<p-calendar name = "calendarMod" [showIcon]="true" [(ngModel)]="actionDate" dateFormat="mm/dd/yy" [inputStyle] = "{'width':'85px'}" ></p-calendar>