Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restangular - _.contains() is not a function

If you have recently updated restangular through bower it will have installed the latest lodash - the new 4.0. However this is a problem as restangular/angular now throws the error - "_.contains() is not a function."

How do you solve?

like image 620
Sten Muchow Avatar asked Jan 21 '16 11:01

Sten Muchow


2 Answers

The solution is very simple - you need to tell restangular to use a lower version than the newest lodash - 3.10.0

Through bower.json

 "lodash": "~3.10.0"

https://github.com/mgonto/restangular/issues/1298

like image 190
Sten Muchow Avatar answered Sep 18 '22 02:09

Sten Muchow


Couldn't you put this in app.js

// If Restangular ever updates to lodash 4.0 remove this.
_.contains = _.includes
like image 33
Garrett Boone Avatar answered Sep 21 '22 02:09

Garrett Boone