标签: angular-ui-bootstrap

angular-ui bootstrap accordion:我如何正确地观察is-open属性?

我正在尝试在特定的手风琴节开始时执行动作.我的用例几乎与这个问题相同,只是我使用的是静态定义的而不是ng-each.

不知何故,当打开状态发生变化时,我无法触发$ watch,任何人都可以告诉我为什么这不起作用:

视图:

  <accordion close-others="false">
   <accordion-group heading="group1" is-open="acc1open">
    content 1
   </accordion-group>    
   <accordion-group heading="group2" is-open="acc2open">
    content 2
   </accordion-group>  
  </accordion>  
Run Code Online (Sandbox Code Playgroud)

控制器:

  $scope.acc1open = false;
  $scope.acc2open = true;

  $scope.$watch('acc1open', function(){
      console.log("watch acc1:" +$scope.acc1open);
  }, true);
Run Code Online (Sandbox Code Playgroud)

这是一个吸烟者:

http://plnkr.co/edit/Ycms81?p=preview

它在页面加载时一次打印"watch acc1:false",但在打开手风琴组时则不打印.

angularjs angular-ui angular-ui-bootstrap

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

Angular UI/bootstrap typeahead显示'错误:无控制器:ngModel'错误

在我的应用程序中,我调用http服务来获取数据,我正在使用angular-ui bootstrap的typeahead指令(ui-bootstrap-tpls-0.6.0.min.js).我有一个部分有一个提到控制器的形式,它包括一个部分内部ng重复.第二部分具有typeahead.

主要形式部分:

<form
    id="myform" 
    name="myform"
    onsubmit="javascript: return false"
    enctype="application/json"
    ng-controller="EducationCollegeCtrl">
    // doing other stuff
    ...

    <div ng-if="model.hasData">
        <div ng-repeat="college in model.academicRecords" ng-form="collegeForm">
            <div ng-include="'resources/appc/modules/main/education/components/collegetype.all.html'"></div>
        </div>
    </div>
    // other stuff going on here
Run Code Online (Sandbox Code Playgroud)

collegetype.all.html:

....
        <label for="institution">Institution name:</label>
        <div>
              <input type="text" ng-model="college.organizationName"  typeahead="item.name for item in matchingInstitutions($viewValue)>
        </div>
        ....
Run Code Online (Sandbox Code Playgroud)

EducationCollegeCtrl.js:

angular.module('theApp',['ui.bootstrap']).controller('EducationCollegeCtrl', function ($scope, $http) {
   ...
    $scope.matchingInstitutions = function(partialName) {
        return $http.get('lookup/institutions?name=' + partialName ).then(function(response){
            return response.data.institutions;
        }); 
    };

   ...
Run Code Online (Sandbox Code Playgroud)

该服务被调用,下拉列表正确显示机构名称.但是在浏览器控制台中,我看到下拉列表中的每个条目都有以下错误

的console.log:

Error: No controller: ngModel
at Error (<anonymous>)
at …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs angularjs-directive angular-ui-bootstrap

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

带有unix时间戳的ui bootstrap datepicker

我正在尝试使用ui-bootstrap datepicker绑定到unix时间戳数据.

为此,我想使用这个指令将unix时间戳转换为ng-model的javascript日期.

这是代码(plunker)

<div ng-model="date" date-format>
    <datepicker min="minDate" show-weeks="false"></datepicker>
</div>
Run Code Online (Sandbox Code Playgroud)

和指令

  .directive('dateFormat', function() {
        return {
              require: 'ngModel',
              link: function(scope, element, attr, ngModelCtrl) {
                    ngModelCtrl.$formatters.unshift(function(timestamp) {
                          if (timestamp) return new Date( timestamp * 1000 );
                          else return "";
                    });
                    ngModelCtrl.$parsers.push(function(date) {
                          if (date instanceof Date) return Math.floor( date.getTime() / 1000 ); 
                          else return "";
                    });
              }
        };
  })
Run Code Online (Sandbox Code Playgroud)

可以选择日期.unix时间戳是正确的但是,日历切换到1970 ...

是否有解决方案使这项工作和使用ui bootstrap的datepicker与unix时间戳数据?

angularjs angular-ui-bootstrap

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

UIBootstrap和Angularjs datepicker选项卡和直接输入

我们正在使用Angularjs和Breeze基于HotTowel模板开发SPA

我们在页面上有多个datePickers,它们给出了以下问题:

  • 当用户选中日期选择器时,datepicker会打开,但在用户选中下一个控件时不会关闭.由于日期选择器堆叠在ui的同一列中,这会导致下拉列表覆盖下面的字段.清除它们的唯一方法是在表单上的其他位置选择日期或单击

  • 在编辑绑定到数据模型的现有记录时,用户无法将日期键入输入区域.如果他们突出显示日期并尝试输入日期,则会删除现有日期,并且不允许用户键入新日期.如果他们单击X以清除输入字段,则无法键入新日期.如果他们将光标定位在日期的末尾,并退格,日期将消失,日历选择器将设置为1902年1月.

基本上,如果用户愿意拿起鼠标并单击选择器中的日期并且从不尝试输入日期,那么这很好.这对我们的用户社区来说是不现实的.

这是html:

                                <label for="ApplicationCompleteDate" data-ng-show="vm.mode === 'edit'"><strong>Application Complete Date:</strong></label>
                            <div class="input-append" data-ng-show="vm.mode === 'edit'">
                                <span>
                                    <input name="ApplicationCompleteDate" type="text" class="form-control input-medium" tabindex="16" placeholder="{{vm.format}}"
                                           datepicker-popup="{{vm.format}}" close-text="Close" show-weeks='false'
                                           is-open="vm.applicationCompleteDateOpened"
                                           datepicker-options="vm.dateOptions"
                                           data-ng-model="vm.formData.dateApplicationComplete"
                                           data-ng-required="vm.applicationCompleteDateRequired"
                                           data-ng-readonly="(!user.isInUserGroup && vm.mode === 'new') || (!user.isInCPUGroup && vm.mode === 'edit')" />
                                </span>
                                <span class="add-on">
                                    <a href="#" data-ng-click="vm.applicationCompleteDateOpen($event)"><i class="icon-calendar"></i></a>
                                </span>
                            </div>
                            <label for="DecisionDatePicker" data-ng-show="vm.mode === 'edit'"><strong>Decision Date:</strong></label>
                            <div class="input-append" data-ng-show="vm.mode === 'edit'">
                                <span>
                                    <input name="DecisionDatePicker" id="ddpID" type="text" class="form-control input-medium" tabindex="14" placeholder="{{vm.format}}"
                                           datepicker-popup="{{vm.format}}" close-text="Close" show-weeks='false'
                                           is-open="vm.decisionDateOpened"
                                           datepicker-options="vm.dateOptions"
                                           data-ng-model="vm.formData.dateDecision" …
Run Code Online (Sandbox Code Playgroud)

datepicker angularjs breeze angular-ui-bootstrap

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

打开焦点列表

我使用angular bootstrap ui(typeahead)尝试在输入聚焦时显示我的客户列表,其中:

lima3app.directive('typeaheadOpenOnFocus', function() {
    return {
        require: ['ngModel'],
        link: function(scope, element, attr, ctrls) {
            element.bind('focus', function() {
                ctrls.$setViewValue('');
                console.log('customer.customer');
            });
        }
    };

});
Run Code Online (Sandbox Code Playgroud)

所以在视图中我设置了我的输入:

<input type="text" class="form-content req" id="form-customer"
       name="formcustomer"
       typeahead="customer as customer.customer for customer in customerList | filter:{customer:$viewValue}"
       typeahead-on-select="onCustomerSelect($item)"
       typeahead-append-to-body="true"
       typeahead-open-on-focus

       ng-model="customer.customer"
       focus="true"
       required="required">
Run Code Online (Sandbox Code Playgroud)

但代码,不起作用.有没有办法做到这一点?

focus typeahead angularjs angular-ui-bootstrap

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

多个月显示角度bootstrap datepicker

Angular UI Bootstrap Datepicker中有一个选项可以显示多个月吗?喜欢numberOfMonthsJQuery datepicker中的选项.

angular-ui angular-ui-bootstrap

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

bootstrap-ui模态不显示它背后的灰色背景,(打开时不添加模态背景类)

出于某种原因我的模态打开时没有灰色背景,虽然我使用与那里的网站相同的代码:http://angular-ui.github.io/bootstrap/#/modal
唯一的区别是我使用了模板来自分离的html文件而不是<script>标签内.

我注意到它没有添加此代码:<div class="modal-backdrop fade in"></div> 在主模式容器内<div class="modal fade in">

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

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

AngularJS + Bootstrap-UI:禁用按钮时启用按钮上的工具提示

请在这里查看我的jsfiddle代码 http://jsfiddle.net/695qtssv/2/

如何在禁用时显示工具提示按钮?

HTML

<div class="panel panel-default">
            <div  ng-repeat="item in itemDetails" tooltip="{{item.name + (isDisabled(item.name)?' is not available' : '')}}">
              <button ng-disabled="isDisabled(item.name)" class="btn btn-primary" ng-click="select(item)">{{item.name}}</button>
            </div>
        </div>
Run Code Online (Sandbox Code Playgroud)

JS:

var myApp = angular.module('myApp', ['ui.bootstrap']);

function MyCtrl($scope) {
    $scope.myModel = "Tooltip only works when input is enabled.";
    $scope.isDisabled = false;

}
Run Code Online (Sandbox Code Playgroud)

我已经尝试在包含按钮的div上使用工具提示,但仍然没有运气,如示例中所示.

此工具提示可以使用,但我不能在我正在使用的应用程序中使用它.

任何帮助将不胜感激.

angularjs angular-ui-bootstrap

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

在Firefox中,UI Bootstrap下拉列表无法使用W/TextAngular ...

我认为我的问题在于"显示"中的下拉按钮.在Chrome中,下拉按预期工作 - 即显示ng-repeat列表中的选项名称列表.但是,在Firefox中,单击下拉列表会禁用文本角度菜单,就像用户在文本角度编辑器外部单击一样(此时文本角度禁用编辑器选项).什么都没有下降.

+行在Chrome中打破了所有工作.我们只是试图让那些不使用大屏幕的人可以读取代码.对于那些不熟悉text-angular的人:所有相关的代码都在显示 - 它只是一些定义下拉列表的html,我认为这就是问题所在.如何在FireFox中使用它?

    taRegisterTool('itemFields', {
        display: '<span class="btn-group" dropdown style="padding: 0px 0px 0px 0px">' +
        '<button class="btn btn-default dropdown-toggle" dropdown-toggle type="button" ng-disabled="showHtml()">' +
        '   <span>Item Fields</span>' +
        '</button>' +
        '<ul class="dropdown-menu">' +
        '   <li ng-repeat="o in options">' +
        '       <a ng-click="action(o)">{{o.name}}</a>' +
        '   </li>' +
        '</ul>' +
        '</span>',
        options: ReportItemFields,
        action: function (option) {
            if( angular.isDefined(option) && angular.isUndefined(option.promise))
            {
                this.$editor().wrapSelection('insertHTML', option.text);
            }
        }
    });
Run Code Online (Sandbox Code Playgroud)

twitter-bootstrap angularjs angular-ui-bootstrap textangular

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

如何使用ng-repeat生成的表的UI Bootstrap分页

我试图在我的Angular应用程序中保持分页使用uib-pagination.我无法正确地做到这一点.

HTML

<table id="mytable" class="table table-striped">
  <thead>
    <tr class="table-head">
      <th>Name</th>
    </tr>
  </thead>
  <tbody>
    <tr ng-repeat="person in aCandidates">
      <th>
        <div>{{person}}</div>
      </th>
    </tr>
  </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

调节器

$scope.totalItems = $scope.aCandidates.length;
$scope.currentPage = 1;
$scope.itemsPerPage = 10;
Run Code Online (Sandbox Code Playgroud)

我能够看到分页栏但是没有执行任何操作,即使在将总项目设为10之后也会呈现整个表格数据.

uib-pagination究竟是如何工作的,以及数据(在这种情况下aCandidates)是如何与分页相关联的.

pagination angularjs angular-ui-bootstrap

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