2017-04-01 50 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

相关问题