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

feat(modals): add an options to append modals to element #731

Open
zl810881283 opened this issue Jul 14, 2016 · 11 comments
Open

feat(modals): add an options to append modals to element #731

zl810881283 opened this issue Jul 14, 2016 · 11 comments

Comments

@zl810881283
Copy link

I follow the modal doc, and find that I should do a small hack in the root component, which is need in my project. I wonder whether I can set modals to child component. what should I do?

import {Component, ViewContainerRef} from '@angular/core';

@Component({selector:'app-root'})
class AppRoot {
  public constructor(viewContainerRef:ViewContainerRef) {
    // You need this small hack in order to catch application root view container ref
    this.viewContainerRef = viewContainerRef;
  }
}
@zl810881283
Copy link
Author

zl810881283 commented Jul 14, 2016

I want to make it clear that both common modal and child modal open with the whole document (maybe ),but I want to it show based on a subelement (like a child div)

@Dinistro
Copy link
Contributor

@zl810881283 This hack is needed, so that the modal_component can access the DOM of the app-root, to add a backdrop.
But you can still add the modals in child-components, no worries.

@Dinistro Dinistro reopened this Jul 14, 2016
@Dinistro
Copy link
Contributor

@zl810881283 Sorry, I did not saw the second comment. So what do you mean with this:

show based on a subelement (like a child div)

@zl810881283
Copy link
Author

zl810881283 commented Jul 14, 2016

@valorkin I want modal only show in #holder . do not dark the whole document

<div class="container">
  <div class="row">
    <div  class="col-md-4">
       some code...
    </div>
    <div  class="col-md-8" id="holder">
       some code...
       <div bsModal></div>
    </div>
  </div>
</div>

@valorkin
Copy link
Member

@zl810881283 not yet implemented, but planned

@valorkin valorkin changed the title if modals can belong to child component ,not the root component request(modals): add an options to append modals to element Jul 21, 2016
@DethAriel
Copy link
Contributor

DethAriel commented Feb 2, 2017

@valorkin could you please clarify: is this issue about appending backdrop component to some given element? This is something I would like to have.

I was envisioning something like this maybe:

<div bsModal [config]="{ backdrop: boolean | 'static' | 'sibling' }">...</div>

@turnerguo
Copy link

Why not add a container property to support custom the target modal container?

<div bsModal [config]="{ container: <HTMLElement> }">...</div>

@valorkin
Copy link
Member

@turnerguo more likely it will appear in modal service as target option

@YevheniiaMazur YevheniiaMazur changed the title request(modals): add an options to append modals to element feat(modals): add an options to append modals to element Jan 15, 2018
@cannontechnology
Copy link

I think ticket 2609 was more appropriate for the following issue but it was closed and pointed to this one.

My application needs to be VPAT complaint and one of the accessibility rules is that "All page content must be contained by landmarks". see https://dequeuniversity.com/rules/axe/3.1/region?application=AxeChrome

Currently the popover component can only be attached to the body via container="body". Could that be extended to append to any DOM element? If so, I could attach to a landmark instead and meet the requirement.

@sanchit315
Copy link

Hey @valorkin do we have any workaround for this now ?

@zl810881283
Copy link
Author

zl810881283 commented May 15, 2024 via email

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

9 participants