Error: Failed to instantiate module restangular due to: '_' is undefined

前端 未结 1 2030
执念已碎
执念已碎 2021-02-05 07:45

When first using Restangular on a working website I got the following JavaScript error:

Failed to instantiate module restangular due to: \'_\' is undefine

1条回答
  •  深忆病人
    2021-02-05 08:31

    It's a simple oversight. The '_' (underscore) is a JavaScript utility library that Restangular uses and depends on. Include Lodash or Undrescore library before the AngularJS library (in your HTML):

    
    

    or

    
    

    PS: Double check the library script and path exist as referenced in your SCRIPT tag.

    Additional readings:

    • Restangular Dependencies
    • Why Does Restangular Depend on lodash / underscore
    • Differences between lodash and underscore

    0 讨论(0)
提交回复
热议问题