Uncaught ReferenceError: _ is not defined from restangular

Issue

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/');
})

Solution

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

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

Answered By – Rayweb_on

Answer Checked By – Senaida (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.