带角js的旋转木马自举

时间:2016-09-07 09:41:47

标签: javascript css angularjs twitter-bootstrap carousel

我需要使用带有两个预定义模板的bootstrap轮播。当我按下右边的按钮时,我需要旋转木马显示品牌标签,当我按下左边的按钮滑回时间temlate时。在我的情况下,任何人都可以帮助我如何使用角度旋转木马。这是我的HTML

<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
  <div class="carousel-inner" role="listbox">
     <div class="item active">
         <div class="col-xs-6">
             <div class="container row">
                 <label class="form-group lable-margin">Date</lable>
             </div>
            <div class="container row">
               <label class="form-group">From: </label> [[stuff.filtersAll.START_DATE]]
            </div>
         <div class="container row">
              <label class="form-group">To: </label> [[stuff.filtersAll.END_DATE]]
         </div>
      </div>
      <div class="col-xs-6">
           <div class="container row">
               <label class="form-group lable-margin">Time</label>
           </div>
           <div class="container row">
               <label class="form-group">From: </label> [[stuff.filtersAll.TIME_FROM]]
           </div>
        <div class="container row">
              <label class="form-group">To: </label> [[stuff.filtersAll.TIME_TO]]
        </div>
    </div>
 </div>
    <div class="item">
           <ul class="list-group" ng-repeat="brads in stuff.filtersAll.BRAND">
              <li class="list-group-item">[[brand.NAME]]</li>
           </ul>
       </div>
   </div>

1 个答案:

答案 0 :(得分:0)

Angular没有right click的任何构建选项。只有click。但你可以为right click

制定这样的指令
app.directive('ngRightClick', function($parse) {
    return function(scope, element, attrs) {
        var fn = $parse(attrs.ngRightClick);
        element.bind('contextmenu', function(event) {
            scope.$apply(function() {
                event.preventDefault();
                fn(scope, {$event:event});
            });
        });
    };
}); 

左键单击使用常规ng-click。在你的html代码中写这样的

<div ng-click="doWhenLeftClick()" ng-right-click="doWhenRightClick()">
    // you html code hear
</div>