标签: angular-ui-bootstrap

嵌套的SELECT选项

我正在寻找一个允许用户在层次结构的下拉列表中查看元素的指令.SELECT标签支持.但这只允许2个级别.我想展示大约5个级别.对于.eg
亚洲
---日本
------东京
------冲绳

用户将能够在任何级别选择项目.

用户可以选择亚洲,日本或东京.所有这些选项都将显示在一个下拉列表中.我不是在寻找级联选择,其中您首先选择大陆,然后选择国家,然后选择城市.

对此有角度指示吗?

谢谢,
Yash

angularjs angular-ui angular-ui-bootstrap

6
推荐指数
1
解决办法
8584
查看次数

ui.bootstrap popover-is-open无法正常工作

我不希望使用popover-is-open指令显示ui.bootstrap popover.例如,在模板中:

  <button class="fa fa-link add-link" 
    uib-popover="popover" 
    popover-is-open="isOpen"> Show popover </i>
Run Code Online (Sandbox Code Playgroud)

在控制器中:

angular.module('demoModule').controller('PopoverDemoCtrl', function ($scope) {
  $scope.isOpen = false;      
});
Run Code Online (Sandbox Code Playgroud)

见plunkr

我希望永远不要打开popover,但是点击它就会打开它.似乎popover-is-open仅影响第一次角度编译.有任何想法吗?

upd:实际上,我想在某些情况下不显示popover,在其他情况下应该显示.例如,我有下载对话框弹出窗口,我只想在文件大小超过某个限制时显示它.

angularjs angular-ui-bootstrap

6
推荐指数
1
解决办法
1万
查看次数

动态选项卡中的动态内容(Angular,UI Bootstrap)

我想在使用AngularJs和UI Bootstrap的动态生成的选项卡的内容中使用ng-include.

我在这里有一个Plunker:http://plnkr.co/edit/2mpbovsu2eDrUdu8t7SM?p = preview

<div id="mainCntr" style="padding: 20px;">
  <uib-tabset>
    <uib-tab ng-repeat="tab in tabs" active="tab.active" disable="tab.disabled">
      <uib-tab-heading>
        {{tab.title}} <i class="glyphicon glyphicon-remove-sign" ng-click="removeTab($index)"></i>
      </uib-tab-heading>
      {{tab.content}}
    </uib-tab>
  </uib-tabset>
</div>
Run Code Online (Sandbox Code Playgroud)

JS代码:

$scope.addTab = function() {
    var len = $scope.tabs.length + 1;
    var numLbl = '' + ((len > 9) ? '' : '0') + String(len);

    var mrkUp = '<div>' +
        '<h1>New Tab ' + numLbl + ' {{foo}}</h1>' + 
        '<div ng-include="tab.tabUrl" class="ng-scope"></div>' +
        '</div>';

    $scope.tabs.push({title: 'Tab ' + numLbl, content: $compile(angular.element(mrkUp))($scope)}); …
Run Code Online (Sandbox Code Playgroud)

angularjs angular-ui-bootstrap angular-ui-bootstrap-tab

6
推荐指数
1
解决办法
1万
查看次数

Angular UI Bootstrap datepicker,视图更改时的回调

我使用Angular UI Bootstrap,这两个版本都是最新版本.

我希望在我的视图发生变化时进行回调,即当我从5月切换到6月时.我需要这个,因为以下情况:

我的日期选择器使用customClass函数显示可用和不可用的日期.我获取当前月份的所有可用性,但是当我单击下一个或上一个时,我没有任何回调来获取新的可用性.

另外,我不想要一次42次异步调用(每个类一次)因为你在de datepicker中也会遇到很多时间问题.我希望有人知道实现这一目标的方法,我现在已经很长时间寻找解决方案了.

我的HTML:

<div class="input-group">
      <span class="input-group-addon" ng-click="vm.OpenDatepicker($event,'1')"><i class="ti-calendar"></i></span>
      <input type="text" class="form-control" datepicker-options="dpOptions" readonly style="cursor:pointer; background-color:white;"
             uib-datepicker-popup="dd-MMMM-yyyy" min-date="minDate" show-weeks="true" ng-model="selectedDate"
             is-open="vm.$scope.datepickers[1]" show-button-bar="false" ng-click="vm.OpenDatepicker($event,'1')" />
</div>
Run Code Online (Sandbox Code Playgroud)

在$ scope.dpOptions(DatePicker Options)中,我定义了自定义类需要的内容:

$scope.dpOptions.customClass= function (data) {
//Here are my availabilities of the first month fetched
//When I change the month in my view, I first want to have the other availabilities 
//so I can return the new red/green classes
};
Run Code Online (Sandbox Code Playgroud)

datepicker twitter-bootstrap angularjs angular-ui angular-ui-bootstrap

6
推荐指数
1
解决办法
1689
查看次数

如果下拉菜单位于浏览器窗口的底部,则使下拉菜单向上移动,根据位置在向下和向上之间自动切换

我在 Dropdown 中遇到问题,但它应该根据窗口大小上升。我在 Angular UI Grid 中遇到了这个问题。请查看链接以更好地理解。

<div ng-controller="MyCtrl">
<div class="container">
    <div class="row">
        <div class="span2">
            <table class="table">
                <tr ng-repeat="row in [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]">
                    <td> <a>{{row}}</a>

                    </td>
                    <td>
                        <ul class="nav">
                            <!-- To create dropups instead of dropdowns i could add the class "dropup" to the li-element below. -->
                            <!-- But what I need is an inteligent mechanism that decides when to use dropdown and when to use dropup -->
                            <li class="dropdown"> <a class="btn-link dropdown-toggle">
                                <i class="icon-align-justify"></i>
                            </a>

                                <ul class="dropdown-menu">
                                    <li ng-repeat="menu …
Run Code Online (Sandbox Code Playgroud)

html javascript css angularjs angular-ui-bootstrap

6
推荐指数
1
解决办法
6494
查看次数

“IPromise&lt;any&gt;”不可分配给类型“Promise&lt;any&gt;”

我正在为用户更改选项卡时构建一个确认对话框。该代码工作正常,但tslint抱怨类型不匹配。控制器看起来像:

export class MyController implements ng.IController {

    constructor(private $transitions: TransitionService,
                private $translate: angular.translate.ITranslateService) {
        'ngInject';

        $transitions.onStart({}, () =>
            this.alert
                .showConfirm(
                    this.$translate.instant('dialogs.confirmLeave.content'),
                    this.$translate.instant('dialogs.confirmLeave.title')
                )
                .then(() => true)
                .catch(() => false)
        );
    }

    ...
}
Run Code Online (Sandbox Code Playgroud)

this.alert.showConfirmthis.$uibModal.open()最终从 angular-ui-bootstrap调用。这会给出以下警告:

error TS2345: Argument of type '() => IPromise<boolean>' is not assignable to parameter of type 'TransitionHookFn'.
  Type 'IPromise<boolean>' is not assignable to type 'boolean | void | TargetState | Promise<boolean | void | TargetState>'.
    Type 'IPromise<boolean>' is not assignable to type …
Run Code Online (Sandbox Code Playgroud)

angularjs typescript angular-ui-bootstrap angular-ui-router

6
推荐指数
1
解决办法
6759
查看次数

AngularJS&ui.bootstrap.modal service templateUrl - 我可以使用Angular路由吗?

我对Angular很新,但很喜欢它!我正在尝试创建一个模态对话框来显示局部视图.ui.bootstap.modal有一个选项,用于显示要显示的局部视图的URL.我在我的应用程序模块上配置了一个如下所示的路由:

angular.module('buggy').config(['$routeProvider',
    function($routeProvider) {
        $routeProvider.
        when('/lists', {
            templateUrl: 'views/lists/list.html'
        }).
        when('/lists/create', {
            templateUrl: 'views/lists/create.html'
        }).
        when('/lists/:listId', {
            templateUrl: 'views/lists/partials/view.html'
        }). //more stuff
Run Code Online (Sandbox Code Playgroud)

我想展示when(/lists/:listId)从上面的路线定义的部分模板.所以在我的控制器中我试图打开模态对话框,如下所示:

 $scope.showList = function (list) {
            $modal.open({
            templateUrl:'lists/' + list._id,
            scope:$scope
        });
    }
Run Code Online (Sandbox Code Playgroud)

模态对话框打开但内容正好[object].我是否需要在服务器端定义路由,还是可以使用Angular路由返回部分路由?

谢谢!

angularjs angular-routing angular-ui-bootstrap

5
推荐指数
1
解决办法
6324
查看次数

解除时显示Bootstrap模态验证

我在AngularJS中有一个表单视图,我使用Angular-ui中的一个模态来显示我的表单.功能方面,一切都很好,但是,当我关闭表单时,如果表单无效,则显示验证弹出窗口.

这就是它的样子:

在此输入图像描述

当表单打开时,弹出窗口根本不显示,但只有当我单击取消并且它开始消失时才会显示.

HMTL:

<form name='newGroupForm'>
    <div class="modal-body">
            <label for="groupName">Group Name:
                <input id="groupName" type="text" ng-model='newGroup.name' required>
            </label>
            <br/>
            <label for="groupDesc">Group Description:
                <input id="groupDesc" type="text" ng-model='newGroup.desc'>
            </label>
            <br/>
            <label for="groupOwner">Group Name:
                <select id="groupOwner" type="text"  ></select>
            </label>
    </div>
    <div class="modal-footer">
        <button class="btn btn-warning" ng-click="cancel()">Cancel</button>
        <button class="btn btn-primary" type="button" ng-click="submit()" ng-disabled="newGroupForm.$invalid">Create</button>
    </div>
</form>
Run Code Online (Sandbox Code Playgroud)

模态控制器:

spApp.controller('newGroupCtrl', 
    function newGroupCtrl($scope, $modalInstance, groupService){
        $scope.newGroup = {
            name:null,
            desc: null
        };

        $scope.submit = function(){
            $modalInstance.close($scope.newGroup);
        }
        $scope.cancel = function (){
            $modalInstance.dismiss('Cancelled group creation');
        };
    }
);
Run Code Online (Sandbox Code Playgroud)

validation twitter-bootstrap angularjs angular-ui angular-ui-bootstrap

5
推荐指数
1
解决办法
6235
查看次数

使用angularJS进行预先输入

我目前使用AngularJS和Bootstrap.我想制作一个类型,当他被选中时(当我点击它时)显示所有选项,不仅当我在上面写了一些东西时.就像这个站点上使用JQuery 的例子(我不能使用JQuery).

这是我的控制器

countrycatControllers.controller('CountryListCtrl',['$scope',
    function ($scope) {
        $scope.listCountry = [
        {"name": "Switzerland"},
        {"name": "France"},
        {"name": "Spain"},
        {"name": "Brazil"},
        {"name": "Argentina"},
        {"name": "USA"},
        {"name": "Canada"},
        {"name": "China"},
        {"name": "Germany"},
        {"name": "Italy"}
        ];
    }
])
Run Code Online (Sandbox Code Playgroud)

这是我的HTML输入:

<pre>Model: {{country | json}}</pre>
<input data-ng-model="country" typeahead="item.name for item in listCountry | filter:$viewValue"/>
Run Code Online (Sandbox Code Playgroud)

twitter-bootstrap angularjs angular-ui-bootstrap

5
推荐指数
1
解决办法
417
查看次数

Angular.js <input type ="date">更改提交值的格式

<label>From</label>
<input type="date"  ng-model="startDate"/>
<label>To</label>
<input type="date" ng-model="endDate"/>

<button class="btn btn-success" ng-click="getStatistics(startDate, endDate)">Update</button>
Run Code Online (Sandbox Code Playgroud)

**JS***

$scope.getStatistics = function(startDate, endDate) {
    $http.get('/admin/api/stats?start=' + startDate + '&end=' + endDate).success(function(data) {
        $scope.stats = data;
    });
}
Run Code Online (Sandbox Code Playgroud)

上面的代码在url上按startDate和endDate值,但我遇到的问题是提交的值类似于2014-12-01,我希望我的格式为01-05-2014

有什么建议?

javascript angularjs angularjs-directive angular-ui-bootstrap

5
推荐指数
1
解决办法
1万
查看次数