2017-04-01 98 views
1

我試圖建立一個ionic2打火卡應用下面這個教程https://devdactic.com/ionic-2-tinder-cards但得到了一個錯誤:無法綁定到'stackConfig',因爲它不是'div'的已知屬性。 (」

Unhandled Promise rejection: Template parse errors: 
Can't bind to 'stackConfig' since it isn't a known property of 'div'. (" 

任何解決方案

+0

我已經完成了幾乎所有在論壇上提出的建議。仍然面臨同樣的問題。你有沒有找到解決方案?如果你有任何工作回購,請與我分享。 – Vasanth

回答

0
cards: Array<any>; 
    stackConfig: any; 
    recentCard: string = ''; 
    constructor(public navCtrl: NavController,private http: Http, public navParams: NavParams,public modalCtrl: ModalController) { 
     this.stackConfig = { 
      throwOutConfidence: (offsetX, offsetY, element) => { 
      return Math.min(Math.abs(offsetX)/(element.offsetWidth/2), 1); 
      }, 
      transform: (element, x, y, r) => { 
      this.onItemMove(element, x, y, r); 
      }, 
      throwOutDistance: (d) => { 
      return 800; 
      } 
     }; 

     } 
     ngAfterViewInit() { 
     // Either subscribe in controller or set in HTML 
     this.swingStack.throwin.subscribe((event: DragEvent) => { 
      event.target.style.background = '#ffffff'; 
     }); 

     this.cards = [{email: ''}]; 
     this.addNewCards(1); 
     } 
+0

使用stackConfig:any;而不是stackConfig:StackConfig; –

0

添加這兩個MOD ules HttpModule,SwingModule到你的pagename.module.ts,因爲本教程使用ionic 2我認爲。我們將不得不單獨添加swing模塊到創建的新頁面。

Individual page's module.ts

相關問題