标签: angular-ui-bootstrap

绑定Angular JS ui-bootstrap下拉切换到ng-model

我试图在表单上使用angularjs bootstrap下拉切换,我需要能够将所选项目绑定回我的应用程序中新"组织"的模型.

这是我用来创建所有控件的js模块:

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

var booleanButtonCtrl = function($scope) {
    $scope.radioModel = true;  
};

var currencyDropDownButtonCtrl = function($scope) {
    $scope.currencies = [{
        id: 1,
        name: 'US Dollar'
    }, {
    id: 2,
    name: 'Euro'
}, {
    id: 3,
    name: 'Australian Dollar'
}];    
};
Run Code Online (Sandbox Code Playgroud)

这是我的CreateNewOrganisation控制器的起始代码

function CreateOrganisationController($scope, $http, $window) {
    $scope.newOrganisation = {
        isActive: true,
};
Run Code Online (Sandbox Code Playgroud)

最后,这是我的html代码片段,其中包含一个for"Status"和一个for Currency,两者都使用ui-bootstrap ...

        <div class="form-group">
            <label class="control-label">Status</label><br />
            <div ng-controller="booleanButtonCtrl">
                <div class="btn-group">
                    <button type="button"
                            class="btn btn-primary"
                            data-ng-model="newOrganisation.isActive"
                            btn-radio="true">
                        Active
                    </button>
                    <button type="button"
                            class="btn …
Run Code Online (Sandbox Code Playgroud)

data-binding html5 angularjs angular-ui-bootstrap

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

ng-options上的Angular UI-Bootstrap下拉按钮

<select class="form-control" data-ng-options="t.name for t in vm.types"
data-ng-model="vm.object.type"></select>
Run Code Online (Sandbox Code Playgroud)

上面的代码显然以标准的表单控制方式显示基本下拉列表.我一直试图弄清楚如何使用Angular的ui-bootstrap指令将其转换为按钮样式下拉列表,但似乎无法获得任何结果.有没人试过这个?

angularjs hottowel angular-ui-bootstrap

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

如何在使用UI路由器进行分页时更改URL?

我有一个使用Angular UI-Router的Angular JS项目很好但是我试图实现UI Bootstrap分页指令并且无法计算出正确的策略.

我有一个数据表,一次显示1页,我有分页指令,显示正确的页面链接数.单击链接时,它会获取新的页码,并对api进行Restangular调用以获取新记录并将它们绑定到表中.

这一切都运行良好,但显然当您浏览数据时,URL不会更改,因此用户无法使用浏览器后退/前进按钮来浏览其历史记录.理想情况下,我想使用以下URL:

/contacts
/contacts/page-2
/contacts/page-3
Run Code Online (Sandbox Code Playgroud)

我还想在URL中包含排序,但这是另一个问题.

我可以实现这一点,但是当点击其中一个分页按钮时,手动转换到一个新状态,但这会重新加载控制器及其所有内容,对服务器进行额外的ajax调用,并将丑陋的非样式内容闪烁为它重新创建了分页控制等.

理想情况下,我可以更改URL并添加历史状态,但不会触发实际状态更改并重新加载/运行该视图的控制器.我不确定这是否可行,更不用说怎么做了.

有人有任何想法吗?

javascript angularjs angular-ui angular-ui-bootstrap angular-ui-router

7
推荐指数
1
解决办法
6678
查看次数

错误:[$ injector:nomod]模块'ui.bootstrap'不可用!而Karma在网络风暴中运行

嗨我在运行karma测试运行时在webstorm中收到以下错误

Error: [$injector:nomod] Module 'ui.bootstrap', 'ui.unique' is not available! 
You either misspelled the module name or forgot to load it. 
If registering a module ensure that you specify the dependencies as the second argument.
Run Code Online (Sandbox Code Playgroud)

我看着互联网,他们说检查依赖文件ui.bootstrap可能会错过这样.

但应用程序工作正常

而只在测试时显示此错误

在我的karma.conf.js中

files: [
            //angular files

            'app/js/vendor/angular/ui.bootstrap.js',
            'app/js/vendor/angular/ui.bootstrap-0.10.0.js',

            'app/js/vendor/angular/angular.js',
            'app/js/vendor/angular/angular-mocks-0.10.6.js',

            'app/js/app.js',
            'test/**/*Spec.js'
        ], 
Run Code Online (Sandbox Code Playgroud)

在我的模块声明中

var myApp = angular.module('myApp', ['ui.bootstrap']);
Run Code Online (Sandbox Code Playgroud)

能否请你帮忙 ??

angularjs angular-ui-bootstrap karma-runner karma-jasmine

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

如何在Angular-UI Bootstrap Modal组件上单元测试'resolve'属性

我正在尝试编写一个单元测试,断言正确的变量被发送到Angular-UI Bootstrap组件的resolve属性ui.bootstrap.modal.这是我到目前为止:

// Controller
angular.module('app')
  .controller('WorkflowListCtrl', function ($scope, $modal) {
    // Setup the edit callback to open a modal
    $scope.edit = function(name) {
      var modalInstance = $modal.open({
        templateUrl: 'partials/editWorkflowModal.html',
        controller: 'WorkflowEditCtrl',
        scope: $scope,
        resolve: {
          name: function() { return name; }
        }
      });
    };
  });
Run Code Online (Sandbox Code Playgroud)

值得注意的是,该resolve.name属性必须是Angular-UI组件正常工作的功能 - 以前我曾尝试resolve: { name: name }但这不起作用.

// Unit Test
describe('Controller: WorkflowListCtrl', function () {

  // load the controller's module
  beforeEach(module('app'));

  var workflowListCtrl,
    scope,
    modal;

  // Initialize …
Run Code Online (Sandbox Code Playgroud)

javascript unit-testing jasmine angularjs angular-ui-bootstrap

7
推荐指数
1
解决办法
3653
查看次数

Angular-ui-bootstrap手风琴和折叠动画不起作用

在angular-ui-bootstrap 演示/文档页面上,手风琴和折叠指令在单击项目时都是动画的.

但是,动画不适用于该页面上的plunker演示.是否缺少某些依赖性或是否可能存在错误?

(在chrome/firefox中测试过)

更新:

我在2015-10-29 更新到版本0.14.3,现在一切都很好.感谢angularUI团队的辛勤工作!

javascript css twitter-bootstrap angularjs angular-ui-bootstrap

7
推荐指数
2
解决办法
6923
查看次数

Angular UI Bootstrap的向后兼容性0.14.0

PR#4514是否进入了0.14.0标签?我最近重新建立了一个项目,现在0.14.0并没有与0.13.x向后兼容.

DropdownController is now deprecated. Use UibDropdownController instead.
vendor.min.js:15dropdown-toggle is now deprecated. Use uib-dropdown-toggle instead.
vendor.min.js:15dropdown-menu is now deprecated. Use uib-dropdown-menu instead.
vendor.min.js:15dropdown is now deprecated. Use uib-dropdown instead.
Run Code Online (Sandbox Code Playgroud)

angular-ui-bootstrap

7
推荐指数
1
解决办法
2203
查看次数

仅在角度UI引导指令中截断文本时显示工具提示

我想仅在文本被截断时显示角度UI bootsrap工具提示.我用自定义指令尝试了下面的代码

<div tooltip="{{value}}" tooltip-append-to-body="true" enable-truncate-tooltip>{{value}}</div>

.directive("enableTruncateTooltip", function () {
  return {
    restrict: 'A',
    link: function (scope, elem, attr) {
      elem.bind('mouseenter', function () {
        var $this = angular.element(this);

        if (this.offsetWidth >= this.scrollWidth) {
          angular.element('.tooltip').attr('hide-tooltip', true);
        }
      });
    }
  }
})
Run Code Online (Sandbox Code Playgroud)

它在angular-ui-bootstrap版本0.12.1中工作正常.但是后来的版本不支持这个.

如何在最新版本的angular-ui-bootstrap中实现相同的功能?

在此先感谢您的帮助.

tooltip angularjs angular-ui-bootstrap

7
推荐指数
1
解决办法
7001
查看次数

AngularJS/ui-bootstrap手风琴 - 点击时滚动到活动(开放)手风琴的顶部

当面板打开时,我需要将其滚动回刚刚单击的面板的".panel-title".我知道我可以创建一个指令来执行此操作,例如(从此站点获取此信息):

.directive( 'scrollTop', scrollTop );

  function scrollTop() {
      return {
          restrict: 'A',
          link: link
      };
  }

  function link( $scope, element ) {
      $scope.collapsing = false;
      $scope.$watch( function() {
          return $(element).find( '.panel-collapse' ).hasClass( 'collapsing' );
      }, function( status ) {
          if ( $scope.collapsing && !status ) {
              if ( $(element).hasClass( 'panel-open' ) ) {
                  $( 'html,body' ).animate({
                      scrollTop: $(element).offset().top - 20
                  }, 500 );
              }
          }
          $scope.collapsing = status;
      } );
  }
Run Code Online (Sandbox Code Playgroud)

在我应该使用的HTML中:

<div uib-accordion-group is-open="status.openPanel" scroll-top></div> …
Run Code Online (Sandbox Code Playgroud)

javascript jquery twitter-bootstrap angularjs angular-ui-bootstrap

7
推荐指数
1
解决办法
2440
查看次数

如何在删除uib-accordion标题时删除出现的蓝色边框?

我尝试过以下问题中提出的解决方案无济于事:

从Chrome中的css自定义样式按钮中删除蓝色边框

如果单击按钮,如何删除按钮中的蓝色框阴影边框

如何删除文本/输入框周围的边框(轮廓)?(铬)

如何删除输入文本元素上的边框突出显示

删除按钮上的蓝色"选定"轮廓

无论如何,要在快速点击时阻止Chrome中的元素蓝色突出显示?

单击时,bootstrap按钮显示蓝色轮廓

单击表单输入字段时如何摆脱蓝色外边框?

在HTML中,我有以下内容:

<uib-accordion-heading>
    <div id="fart1" ng-if="!contactsAccordionIsOpen" class="noSelect" style="outline: none;">Contacts<span class="glyphicon glyphicon-plus-sign pull-right"></span></div>
    <div id="fart2" ng-if="contactsAccordionIsOpen" class="noSelect" style="outline: none;">Contacts<span class="glyphicon glyphicon-minus-sign pull-right"></span></div>
</uib-accordion-heading>
Run Code Online (Sandbox Code Playgroud)

整个手风琴标题周围没有出现蓝色轮廓,但形状适合文本.我尝试过内联样式,按ID和类选择,但即使!important它没有改变.

在CSS我有:

#fart1:focus {
    border: none !important;
    outline: none !important;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#fart2:focus {
    border: none !important;
    outline: none !important;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.noSelect {
    border: none …
Run Code Online (Sandbox Code Playgroud)

css twitter-bootstrap angular-ui-bootstrap

7
推荐指数
3
解决办法
6577
查看次数