我正在尝试按照本教程https://devdactic.com/ionic-2-tinder-cards在ionic2中构建一个火种卡应用,但是出现了错误:
Unhandled Promise rejection: Template parse errors:
Can't bind to 'stackConfig' since it isn't a known property of 'div'. ("
任何解决方案?
答案 0 :(得分:1)
答案 1 :(得分:0)
您需要在app.module.ts中添加SwingModule导入。请参阅https://github.com/ksachdeva/angular2-swing-example/blob/master/src/app/app.module.ts config/environment/production.rb
enter code here
答案 2 :(得分: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);
}