【问题标题】:Using an NPM module from Ionic使用 Ionic 的 NPM 模块
【发布时间】:2017-06-24 00:36:19
【问题描述】:

我正在使用 ionic 1.3.1,我想使用 npm 电话模块 here 在客户端验证电话号码。

在查看如何使用 npm 模块时,我按照this SO post(底部的最后一个答案)中的说明将电话目录从 npm_modules 复制到 www/lib。然后我将 lib/phone/lib/index.js 文件包含在我的 index.html 中。

当我打开带有ionic serve 的页面时,我收到错误“找不到模块”。

我看到了在 Ionic v2 中使用 npm 的解决方案,但还没有准备好迁移到 v2。我还看到一些指向使用 Browserify 的答案,但如果我不需要,我会尽量避免使用新工具 - 感觉必须有一种简单的方法可以在 ionic 中使用 npm 模块。

感谢任何帮助解决问题的指针。

桑杰

【问题讨论】:

    标签: ionic-framework npm


    【解决方案1】:

    由于我无法弄清楚这一点,我只是从 index.js 文件中的代码为 npm phone 模块创建了一个 Angular 服务。

    【讨论】:

      猜你喜欢
      • 2021-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-02
      • 1970-01-01
      • 2016-07-18
      • 2014-03-07
      • 2020-04-22
      相关资源
      最近更新 更多