无法绑定到'stackConfig',因为它不是'div'的已知属性。 (”

时间:2017-04-01 14:32:05

标签: ionic-framework ionic2

我正在尝试按照本教程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'. ("

任何解决方案?

3 个答案:

答案 0 :(得分:1)

将这两个模块HttpModule,SwingModule添加到你的pagename.module.ts,因为我认为教程使用了离子2。我们必须单独将swing模块添加到创建的新页面中。

Individual page's module.ts

答案 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);
      }