-
Notifications
You must be signed in to change notification settings - Fork 5k
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
[bug?] Menus will not display on dynamic content #4243
Comments
I am using angular 2 |
`
<script>
var button = document.createElement('button');
var textNode = document.createTextNode('Click Me!');
button.appendChild(textNode);
button.className = 'mdl-button mdl-js-button mdl-js-ripple-effect';
componentHandler.upgradeElement(button);
document.getElementById('container').appendChild(button);
</script>`
You need to use the componentHandler to fix this problem |
Calling Eg. in angular 2: ngAfterViewInit() {
window.componentHandler.upgradeAllRegistered();
} |
Ahh great answer tjoskar. I will try that |
For the typescript users. You might want to declare the window object on top.
|
I seem to have seen possible issues when using Angular 2, but I'm too much of a beginner to add anything meaningful at this stage. |
Please use StackOverflow for support and integration assistance. This tracker is only for problems with the code provided by Material Design Lite. Thank you. |
The menu items won't display if the content is loaded from the backend (dynamic data)
My code
<button id="menu-speed" class="mdl-button mdl-js-button mdl-button--icon"> <i class="material-icons">more_vert</i> </button> <ul class="mdl-menu mdl-js-menu" for="menu-speed"> <li class="mdl-menu__item">Fast</li> <li class="mdl-menu__item">Medium</li> <li class="mdl-menu__item">Slow</li> </ul>
In non dynamic content the current div is added:
<div class="mdl-menu__outline mdl-menu--bottom-right" style="width: 148.313px; height: 208px;"></div>
Am i doing something wrong or is this a bug?
The text was updated successfully, but these errors were encountered: