简体   繁体   English

libphonenumber:没有定义goog

[英]libphonenumber: goog is not defined

I am trying to use Google's libphonenumber library in my project. 我正在尝试在我的项目中使用Google的libphonenumber库。 I am trying to validate a phone number input using the javascript version, but it is giving me a "goog is not defined" error. 我正在尝试使用javascript版本验证电话号码输入,但它给了我一个“goog未定义”错误。 I am very new to javascript andI have already spent a day searching for an answer and couldn't find one. 我是javascript的新手,我已经花了一天时间寻找答案而找不到答案。 The error is in the phonenumberutil.js on the very first line where it says 错误发生在第一行的phonenumberutil.js中

goog.provide('i18n.phonenumbers.Error'); goog.provide( 'i18n.phonenumbers.Error');

This library needs the closure library and I have added it as 这个库需要关闭库,我已将其添加为

<!--    Scripts for google phone number validation utils -->
    <tags:script source="/js/GooglePhoneNumberUtils/phonenumberutil.js"/>
    <script src="http://closure-library.googlecode.com/svn/trunk/closure/goog/base.js"></script>
    <script>
      goog.require('goog.dom');
      goog.require('goog.json');
      goog.require('goog.proto2.ObjectSerializer');
      goog.require('goog.string.StringBuffer');
    </script>

I have no idea whats going on so please any help will be useful. 我不知道发生了什么,所以请任何帮助都有用。

首先包括'base.js',然后'phonenumberutil.js'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM