2016-09-30 99 views

回答

1

不需要像Angular 2那樣類似的東西。你也可以在Angular 2中使用它。這是一個plunkr顯示這一點。

@Component({ 
    selector: 'my-app', 
    template: ` 
    <div class="container"> 
     <div class="scroller scroller-left"><i class="glyphicon glyphicon-chevron-left"></i></div> 
     <div class="scroller scroller-right"><i class="glyphicon glyphicon-chevron-right"></i></div> 
     <div class="wrapper"> 
     <ul class="nav nav-tabs list" id="myTab"> 
      <li *ngFor="let tab of tabs" class="{{tab.active ? 'active' : ''}}"> 
      <a href="#{{tab.name}}">{{tab.name}}</a> 
      </li> 
     </ul> 
     </div> 
    </div> 
    `, 
    }) 
    export class App { 
    tabs: any[] = []; 

    constructor() { 
     for(var i = 1; i < 21; i++){ 
     this.tabs.push({ 
      name: "Tab" + i, 
      active: i === 1 ? true : false 
     }); 
     } 
    } 

    ngAfterViewInit(){ 
     //Do jquery stuff to access the DOM 
    } 
    } 
+0

非常感謝易卜拉欣。這太棒了。 –

0

OR你可以使用這個非常容易使用的角度圖書館 -

https://www.npmjs.com/package/angular2-drag-scroll