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

Support multiple classes in MdDialog's panelClass #6318

Closed
VagrantAI-c opened this issue Aug 7, 2017 · 4 comments · Fixed by #6326
Closed

Support multiple classes in MdDialog's panelClass #6318

VagrantAI-c opened this issue Aug 7, 2017 · 4 comments · Fixed by #6326
Assignees

Comments

@VagrantAI-c
Copy link

VagrantAI-c commented Aug 7, 2017

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

I want MdDialogConfig to have option for panelClass to be an array of classes, like
panelClass: ['custom-container', 'widget-container']

What is the current behavior?

Currently there could be only one panelClass per dialog

What is the use-case or motivation for changing an existing behavior?

I want to add various classes depending on environment, but i have no such option and i have to include all possible combinations into separate classes

@willshowell
Copy link
Contributor

Should be able to do

panelClass: 'custom-container widget-container'

That said, I wish all the overlay class api's were NgClass-compatible

@VagrantAI-c
Copy link
Author

@willshowell I believe that is not possible, doing

let config = new MdDialogConfig();
config.panelClass = 'custom-container widget-container';

gives me next error:

ERROR DOMException: Failed to execute 'add' on 'DOMTokenList': The token provided ('custom-container widget-container') contains HTML space characters, which are not valid in tokens.
    at OverlayRef.webpackJsonpac__name_.5.OverlayRef.attach (http://localhost:8080/site/vendor.bundle.js:51819:34)
    at MdDialog.webpackJsonpac__name_.5.MdDialog._attachDialogContainer (http://localhost:8080/site/vendor.bundle.js:67867:53)
    at MdDialog.webpackJsonpac__name_.5.MdDialog.open (http://localhost:8080/site/vendor.bundle.js:67809:53)

etc.

@willshowell
Copy link
Contributor

Oh yeah, you're right. Maybe some combination of this with an isArray check would do it

- this._pane.classList.add(this._state.panelClass);
+ this._pane.classList.add(...this._state.panelClass);

@crisbeto crisbeto self-assigned this Aug 7, 2017
@crisbeto crisbeto added the has pr label Aug 7, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 7, 2017
Allows for more than one class to be added via the `panelClass` option.

Fixes angular#6318.
mmalerba pushed a commit that referenced this issue Aug 7, 2017
Allows for more than one class to be added via the `panelClass` option.

Fixes #6318.
mmalerba pushed a commit that referenced this issue Aug 7, 2017
Allows for more than one class to be added via the `panelClass` option.

Fixes #6318.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants