I am utilizing angular2 to design a few input forms. They are disabled when the user lacks permission to modify them, but upon an admin login, the inputs become enabled. In order to enhance visibility, I attempted to style them with gray when disabled and white when enabled.
Within the html code:
<input type="text" class="form-control" [style.background]="cssColor" name="" [disabled]="!editionEnable" placeholder="value"
[(ngModel)]="class.property" />
I also experiment with
[style.backgroundColor]="cssColor"
, which did not alter the background color. Additionally, I tried [ngStyle]="{'background-color': cssColor}">
along with declaring cssColor in various ways:
- cssColor:string="#F0F0F0 !important";
- cssColor:string="#F0F0F0";
- cssColor:string="F0F0F0";
I included the !important because when editing with web developer tools in Firefox, the background color does not change without it.
note: I am using Twitter Bootstrap
Any suggestions on what I might be doing incorrectly? Working with angularjs made this process much simpler.