简体   繁体   English

在md-dialog中的Angular-Material md-select

[英]Angular-Material md-select in md-dialog

I have an angular material app in which I have a button that triggers a dialog box with a dropdown in it. 我有一个角度材料应用程序,其中我有一个按钮,触发一个带有下拉列表的对话框。 If the button is at the top, everything works fine and as expected. 如果按钮位于顶部,则一切正常并且符合预期。

If the button is towards the bottom so the user has to scroll to get to it, however, once the dropdown is hit, the page jumps back to the top. 如果按钮朝向底部,那么用户必须滚动才能到达它,但是,一旦下拉按下,页面就会跳回到顶部。 The dialog box stays open at the bottom and I can't scroll down to it or click out of it, so I have to reload the page to do anything and the dialog box is useless. 对话框在底部保持打开状态,我无法向下滚动或单击它,所以我必须重新加载页面以执行任何操作,对话框无用。

If I use 如果我使用

<select ng-options="opt.val as opt.name for opt in options" ng-model="d"></select>

then it works fine. 然后它工作正常。

But if I use a md-select 但是如果我使用md-select

<md-select ng-model="d">
    <md-option ng-value="opt.val" ng-repeat="opt in options">{{opt.name}}</md-option>
</md-select>

then it breaks. 然后就打破了。

jsfiddle: https://jsfiddle.net/st3m3x0g/3/ jsfiddle: https ://jsfiddle.net/st3m3x0g/3/

If you scroll all the way to the bottom of the output, click a button, then try to open the dropdown, you can see the issue. 如果您一直滚动到输出的底部,单击按钮,然后尝试打开下拉列表,您可以看到问题。

Is there any way to avoid this? 有什么方法可以避免这种情况吗?

这个功能在角度材料v0.9.8中不起作用,实际上我需要一个对话框上的功能,当我在框外面点击它应该隐藏在v 0.9.8的角度材料中。

This has been fixed in v0.9.0 这已在v0.9.0修复

See issue 1648 for further details. 有关详细信息,请参见问题1648

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM