Uncaught ReferenceError: _ is not defined from restangular

Carlos Bergen picture Carlos Bergen · Jun 24, 2013 · Viewed 24.4k times · Source

I'm getting this error: Uncaught ReferenceError: _ is not defined from restangular when trying to use Restangular.

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>
<script type="text/javascript" src="http://cdn.jsdelivr.net/restangular/latest/restangular.min.js"></script>
<script src="app.js"></script>
<script src="controllers.js"></script>

app.js

var contactManager = angular.module('contactManager', ['restangular'])
contactManager.config(function(RestangularProvider){
    RestangularProvider.setBaseUrl('/api/');
})

Answer

Rayweb_on picture Rayweb_on · Jun 24, 2013

you need to add a script reference to underscore, as is a dependency

 <script src="https://cdn of underscore"></script>