Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to set default Dark Theme #85

Open
Nsisodia91 opened this issue Nov 12, 2018 · 2 comments
Open

Not able to set default Dark Theme #85

Nsisodia91 opened this issue Nov 12, 2018 · 2 comments

Comments

@Nsisodia91
Copy link

No description provided.

@Nsisodia91
Copy link
Author

This is with regards to setting up the material keyboard to dark theme. Based on the documentation and code base, I'm changing the keyboard to dark theme on input control's focus event as below;

 private _keyboardRef: MatKeyboardRef<MatKeyboardComponent>;

 @ViewChild('username', { read: ElementRef })
 private _usernameElement: ElementRef;

temp() {
        this._keyboardRef = this._keyboardService.open(this.locale, {
            darkTheme: this.darkTheme
        });

        //reference the input element
        this._keyboardRef.instance.setInputInstance(this._usernameElement);
 }

This is not a good approach as I've to declare elementRef for all the input controls and execute this function everywhere.

Is there a way to set the dark theme globally for all the input controls during the component initialization?

@davidenke
Copy link
Collaborator

What you're doing is basically covered by the structural directive which should be preferred for binding inputs to the keyboard.

For now there's no way for setting a base config, but it shouldn't be too difficult to provide one as injection token and setting it as default on initialization. I would like to see a PR for that.

Unfortunately I don't have the time I would like to have for this project and my last efforts was introducing tests and stabilizing angular / material stability with automated tests. After this I hope to find time to refactor and implement features like a base config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants