问题描述:

  在基于懒加载的Ionic工程中,使用ionic2-auto-complete组件(GitHub地址:https://github.com/kadoshms/ionic2-autocomplete),出现以下错误提示:

在懒加载的Ionic工程中使用 ionic2-auto-complete 组件:Can't bind to 'dataProvider' since it isn't a known property of 'ion-auto-complete'

说明:组件使用均是按照GitHub上的标准写法,

在非懒加载的Ionic工程中可以正常使用(可以参看我另外一篇博客:http://www.cnblogs.com/crazyprogrammer/p/6925199.html),

但是工程在改造成懒加载模式后,会出现上述错误,经过分析是因为AutoCompleteModule引起的问题。

 

解决方案:

  在使用ion-auto-complete的Component中,在module.ts文件中同样需要import AutoCompleteModule。如下图:

在懒加载的Ionic工程中使用 ionic2-auto-complete 组件:Can't bind to 'dataProvider' since it isn't a known property of 'ion-auto-complete'

组件即可正常加载,如下:

在懒加载的Ionic工程中使用 ionic2-auto-complete 组件:Can't bind to 'dataProvider' since it isn't a known property of 'ion-auto-complete'

 

相关文章:

  • 2021-05-24
  • 2021-12-04
  • 2021-09-06
  • 2021-04-20
  • 2021-07-21
  • 2021-10-09
  • 2021-06-05
  • 2022-12-23
猜你喜欢
  • 2021-04-16
  • 2021-06-15
  • 2021-04-25
  • 2022-12-23
  • 2022-12-23
  • 2021-07-14
相关资源
相似解决方案