angular bootstrap 左侧打开下拉菜单

angular bootstrap dropdown to open on left

我已成功使用 angular bootstrap 下拉菜单 link。 但问题在于下拉菜单在右侧打开。 我怎样才能让它在左边打开? 这是我从给定 link.

使用的标记和 js

标记:

<div ng-controller="DropdownCtrl">
<!-- Single button with keyboard nav -->
<div class="btn-group" uib-dropdown keyboard-nav>
    <button id="simple-btn-keyboard-nav" type="button" class="btn btn-primary" uib-dropdown-toggle>
        Dropdown with keyboard navigation <span class="caret"></span>
    </button>
    <ul uib-dropdown-menu role="menu" aria-labelledby="simple-btn-keyboard-nav">
        <li role="menuitem"><a href="#">Action</a></li>
        <li role="menuitem"><a href="#">Another action</a></li>
        <li role="menuitem"><a href="#">Something else here</a></li>
        <li class="divider"></li>
        <li role="menuitem"><a href="#">Separated link</a></li>
    </ul>
</div>
</div>

js:

angular.module('ui.bootstrap.demo').controller('DropdownCtrl', function ($scope, $log) {
$scope.items = [
'The first choice!',
'And another choice for you.',
'but wait! A third!'
];

$scope.status = {
isopen: false
};

$scope.toggled = function(open) {
$log.log('Dropdown is now: ', open);
};

$scope.toggleDropdown = function($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.status.isopen = !$scope.status.isopen;
};

$scope.appendToEl = angular.element(document.querySelector('#dropdown-long-content'));
});

请帮忙

将 class dropdown-menu-right 添加到您的 <ul uib-dropdown-menu>

默认情况下,下拉菜单打开时与父项的左侧对齐并向右侧增长。添加 class dropdown-menu-right 后,它将在右侧对齐打开。

编辑:
Angular Bootstrap 和 Bootstrap 4 允许使用 placement 属性(可能选择 bottom-rightrighttop-right).
资料来源:https://ng-bootstrap.github.io/#/components/dropdown/api

Vue-Bootstrap 提供了 right 属性(布尔值)。
资料来源:https://bootstrap-vue.js.org/docs/components/dropdown/#bd-content

React-bootstrap 调用属性 pullRight (boolean)
资料来源:https://react-bootstrap.github.io/components/dropdowns/#btn-dropdowns-right