标签: angular-ui-bootstrap

在angularstrap datepicker中手动触发显示/隐藏

我想使用一个按钮来显示和隐藏日期选择器.

http://mgcrea.github.io/angular-strap/##datepickers

没有关于如何做到这一点的文件

var app = angular.module('mgcrea.ngStrapDocs', ['ngAnimate', 'ngSanitize', 

'mgcrea.ngStrap']);

app.controller('MainCtrl', function($scope) {
});

'use strict';

angular.module('mgcrea.ngStrapDocs')

.config(function($datepickerProvider) {
  angular.extend($datepickerProvider.defaults, {
  dateFormat: 'dd/MM/yyyy',
  startWeek: 1,trigger:manual
  });
  })

.controller('DatepickerDemoCtrl', function($scope, $http,$datepicker) {


 //ng-click
  $scope.datepickerpop = function() {

   $datepicker.show();
   //$datepicker._show();

  };

 });
Run Code Online (Sandbox Code Playgroud)

angularjs angular-ui-bootstrap angular-strap

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

角度UI模态打开的承诺在模态显示之前解决

我试图在打开的模式上执行jQuery脚本,以便将其中一个字段转换为a jQuery UI Spinner.

我正在使用Angular UI中opened记录的承诺.

问题: jQuery选择器无法按预期工作,也无法检索任何内容.

所以我的控制器的一个功能看起来像这样:

var modalInstance = $modal.open({
    templateUrl: 'modalDialog.html',
    controller: modalCtrl,
    resolve: {
        noOfItems: function(){
            return $scope.noOfItems;
        }
    }
});

modalInstance.opened
    .then(function () {
        $(".spinner").spinner({
            max: 20,
            min: 1
        });
    });

modalInstance.result
    .then(function () {
        console.log("modal closed");
    });
Run Code Online (Sandbox Code Playgroud)

我的HTML:

<script type="text/ng-template" id="modalDialog.html">
    <div class="modal-header">
        <h4 class="modal-title">My Modal</h4>
    </div>
    <div class="modal-body">
        <input class="form-control spinner" type="text" ng-model="noOfItems" />
    </div>
    <div class="modal-footer">
        <button class="btn btn-default" ng-click="cancel()">Cancel</button>
        <button class="btn btn-primary" ng-click="save()">Save</button>
    </div>
</script>
Run Code Online (Sandbox Code Playgroud)

这 …

jquery jquery-ui angularjs angular-ui-bootstrap

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

我需要包括角度引导程序只是简单的工作

我已将这些包含在我的index.html中,因为bower包含它们:

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">

<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<!-- endbower -->
Run Code Online (Sandbox Code Playgroud)

为什么不包括ui-bootstrap.js?因为来自bootstrap的bower.json及其主要属性设置了"ui-bootstrap-tpls.js"但是ui-bootstrap.js呢?

即使我将文件包含在凉亭外:js标签,来自日期选择器的弹出窗口也不可见,我的谷歌浏览器中没有错误.

但是当我点击datepicker按钮时没有popover ...

UPDATE

现在我纠正了我的angularjs模块,现在我使用这个: 'ui.bootstrap.datepicker'

我现在在谷歌浏览器中得到这些错误:

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/template/datepicker/datepicker.html
Error: [$compile:tpload] Failed to load template: template/datepicker/datepicker.html
Run Code Online (Sandbox Code Playgroud)

当我查看源ui-bootstrap-tpls.js文件时:

.directive( 'datepicker', function () {
  return {
    restrict: 'EA',
    replace: true,
    templateUrl: 'template/datepicker/datepicker.html',
    scope: {
      datepickerMode: '=?',
      dateDisabled: '&'
    },
Run Code Online (Sandbox Code Playgroud)

这些路径模板在哪里?我不是他们.我刚安装了angular-bootstrap凉亭包.是否应该包括所有内容?

UPDATE2

我现在得到这些angularjs错误:

在此输入图像描述

看到父级为null,因此parent.InsertBefore无法工作并抛出异常...

angularjs angular-ui bower angular-ui-bootstrap

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

angular.ui.popover无法使用最新的角度1.3.3和angular.ui.bootstrap 0.12.0

我创造了这支笔:

http://codepen.io/anon/pen/vEOKEK

如果我使用角度为1.2.X,它会起作用,但是一旦我进入1.3就会死掉.我需要能够使用popover-template.

      <p>
    <button popover-placement="bottom" popover-template="calendar.html" class="btn btn-default">Date Picker</button>
  </p>

  <script id="calendar.html" type="text/ng-template">
    <div ng-model="date">
      <datepicker show-weeks="false"></datepicker>
    </div>
    <hr />
    <div class="alert alert-success">{{ text }}</div>
  </script>
Run Code Online (Sandbox Code Playgroud)

twitter-bootstrap angularjs angular-ui-bootstrap

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

单击angular ui选项卡会多次触发事件

我有15个标签使用像这样的角度ui标签

这是模板

<tabset justified="true">
    <tab heading="{{ tab.display }}"
         select="tsc.selectTab(tab.date)"
         ng-repeat="tab in tsc.tabs">
         <div ng-include="'entries.html'"></div>
    </tab>
</tabset>
Run Code Online (Sandbox Code Playgroud)

这是控制器

$scope.activeTabDate = '';

self.selectTab = function (tabDate) {
    $scope.activeTabDate = tabDate;

};
Run Code Online (Sandbox Code Playgroud)

现在这是entries.html的我的子控制器

$scope.$parent.$watch('activeTabDate', function (newValue, oldValue) {
    if (newValue !== oldValue) {
        console.log('--'+newValue);
    }
});
Run Code Online (Sandbox Code Playgroud)

我在页面上有15个标签.我的问题是每次我点击标签.在console.log中,我得到15个条目而不是一个条目.这是为什么

javascript tabs angularjs angular-ui-bootstrap

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

$ uibModalInstance undefined(AngularJS UI.Bootstrap)

为什么$ uibModalInstance无法注入此处?

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

baseController.$inject = ['$uibModal', '$uibModalInstance'];

function baseController($uibModal, $uibModalInstance) {

self.ok = function () {
$uibModalInstance.close(self.selected.item);
};

self.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
Run Code Online (Sandbox Code Playgroud)

我正在尝试访问$ uibModalInstance,如果我尝试注入它,我会收到注入错误.

如果我不注射它,那么它是未定义的......

modal-dialog angularjs angular-ui-bootstrap

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

uib-datepicker动态最小日期angularjs

我有一个简单的代码,使用uib-datepicker-popup 2个日期:

          <div>
           <p class="input-group">
            <input type="date" class="form-control" uib-datepicker-popup ng-model="adSearch.initDate" is-open="status1.opened" close-text="Close" />
            <span class="input-group-btn">
             <button type="button" class="btn btn-default" ng-click="open($event, 'initDate')"><i class="glyphicon glyphicon-calendar"></i></button>
            </span>
           </p>
          </div>
          <div>
           <p class="input-group">
            <input type="date" class="form-control" uib-datepicker-popup ng-model="adSearch.endDate" is-open="status2.opened" close-text="Close" min-date="{{minEndDate}}" />
            <span class="input-group-btn">
              <button type="button" class="btn btn-default" ng-click="open($event, 'endDate')"><i class="glyphicon glyphicon-calendar"></i></button>
            </span>
           </p>
          </div>
Run Code Online (Sandbox Code Playgroud)

我需要从第一个日期开始在第二个日期中动态设置一个最小日期。我尝试了不同的方法,但没有一个可以工作

$scope.open = function($event, date) {
  if(date === 'initDate'){
    $scope.status1.opened = true;
  }else if(date === 'endDate'){
    $scope.status2.opened = true;
  }
}; 

$scope.status1 = {
  opened: false
}; 

$scope.status2 = …
Run Code Online (Sandbox Code Playgroud)

datepicker angularjs angular-ui-bootstrap

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

AngularJs - UI Bootstrap Popover

您好我在Angular App中使用UI boostrap我想使用UI boostrap添加Popover,所以这就是我到目前为止所做的:

 <a popover popover-template="'tpl.html'" data-img="http://domain.com/img1.jpg" data-title="Link 1 title" data-content = "Link 1 content...">Link 1</a>
 <a popover popover-template="'tpl.html'" data-img="http://domain.com/img2.jpg" data-title="Link 2 title" data-content = "Link 2 content...">Link 2</a>
 ...
 <a popover popover-template="'tpl.html'" data-img="http://domain.com/imgn.jpg" data-title="Link n title" data-content = "Link n content...">Link n</a>
Run Code Online (Sandbox Code Playgroud)

然后注入属性:data-img,data-title,data-content在这个模板tpl.html:

 <div class="popover-content">
 <md-card>
    <img ng-src="{{$img}}" class="md-card-image" >
    <md-card-title>
      <md-card-title-text>
        <span class="md-headline">{{ $title}}</span>
      </md-card-title-text>
    </md-card-title>
    <md-card-content>
    {{ $content }}
    </md-card-content>
  </md-card>
</div> 
Run Code Online (Sandbox Code Playgroud)

当然它不起作用:)

我的问题是:如何a在模板中注入元素属性tpl.html? …

angularjs angular-ui-bootstrap

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

$ uibModal.open()不是函数

我正在尝试集成Angular bootstrap模态形式,

这是我的控制器

angular.module('app').controller('groupController',['groupService','$uibModal','toastr','$scope',function(groupService,toastr,$uibModal,$scope)
Run Code Online (Sandbox Code Playgroud)

我添加了$ uibModal作为依赖.在我的app.js中我也添加了ui.bootstrap作为依赖项,

我的angular.bootstrap版本是1.3.3

我的模态功能如下

vm.viewGroupDetail = function(userDetails) {

    var scope = $scope.$new();
    scope.userDetails = userDetails;

    vm.modalInstance = $uibModal.open({
        animation: true,
        templateUrl: 'app/views/groups/group_details_modal.html',
        windowClass: 'd-modal',
        size: 'md',
        scope: scope
        // resolve: {
        //  userDetails: function () {
        //      return ;
        //  }
        // }
    });



};
Run Code Online (Sandbox Code Playgroud)

当我尝试使用断点并检查控制流时,它进入viewGroupDetail函数.但是在$ uibModal.open()时,控件会中断

我在这里失踪了什么?我在堆栈溢出中尝试了其他相关问题,没有给我一个解决方案,所以发布我自己的查询

angularjs angular-ui-bootstrap angular-bootstrap

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

使用Angular UI Carousel进行`跟踪$ index'的问题

当使用分页时,索引跟踪的$ index不会从零开始

我用角度ui bootsrap创建了一个旋转木马.由于我加载了如此多的图像(超过1,000),我使用过滤器在分页中显示500张图片.

.filter('pages', function () {
    return function (input, currentPage, pageSize) {
        if (angular.isArray(input)) {
            var start = (currentPage - 1) * pageSize;
            var end = currentPage * pageSize;
            return input.slice(start, end);
        }
    };
})
Run Code Online (Sandbox Code Playgroud)

控制器:

self.currentPage = 1;
self.itemsPerPage = 500;
self.maxSize = 10;

//imagesUrls is response.data from http call
angular.forEach(imagesUrls, function (parent) {
    var date = uibDateParser.parse(parent.fileCreationTime, 'M/d/yyyy 
                     hh:mm:ss a');
    // fill our slide arrays with urls
    // model update here
    self.slides.push({
        image: parent.fileName,
        time: date, …
Run Code Online (Sandbox Code Playgroud)

angularjs angularjs-ng-repeat angular-ui-bootstrap

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