mgonto / restangular

AngularJS service to handle Rest API Restful Resources properly and easily
MIT License
7.87k stars 840 forks source link

_.includes in restangular not working #1448

Closed basav22 closed 7 years ago

basav22 commented 7 years ago

To open an issue, please keep in mind a few important things. First, take a look at the README docs and make sure that your question isn't already answered in the documentation. In particular, review the configuration methods and methods description. Then make sure you search the issues list to see if there's already an issue open that solves your problem. Then, once you've determined that your issue isn't a duplicate, here a couple guidelines to opening an issue that will be addressed easily and quickly:

basav22 commented 7 years ago

installed restangular from bower with 1.5.2. It has dependency of lodash.js and lodash has removed _.includes method. Hence restangular is breaking

bostrom commented 7 years ago

In version 1.5.2 the lodash dependency requires a version greater than or equal to 1.3.0. Unfortunately, the includes method used is found only in version 3 and above. This has been corrected in version 1.6.0, but even when installing Restangular 1.5.2 through Bower in a fresh project, it pulls a compatible version of lodash with it.

$ bower install restangular#1.5.2
bower restangular#1.5.2         cached https://github.com/mgonto/restangular.git#1.5.2
bower restangular#1.5.2       validate 1.5.2 against https://github.com/mgonto/restangular.git#1.5.2
bower angular#~1.x              cached https://github.com/angular/bower-angular.git#1.6.1
bower angular#~1.x            validate 1.6.1 against https://github.com/angular/bower-angular.git#~1.x
bower lodash#>=1.3.0            cached https://github.com/lodash/lodash.git#4.17.3
bower lodash#>=1.3.0          validate 4.17.3 against https://github.com/lodash/lodash.git#>=1.3.0
bower lodash#>=1.3.0               new version for https://github.com/lodash/lodash.git#>=1.3.0
bower lodash#>=1.3.0           resolve https://github.com/lodash/lodash.git#>=1.3.0
bower lodash#>=1.3.0          checkout 4.17.3
bower lodash#>=1.3.0          resolved https://github.com/lodash/lodash.git#4.17.3
bower restangular#1.5.2        install restangular#1.5.2
bower angular#~1.x             install angular#1.6.1
bower lodash#>=1.3.0           install lodash#4.17.3

restangular#1.5.2 bower_components/restangular
├── angular#1.6.1
└── lodash#4.17.3

angular#1.6.1 bower_components/angular
lodash#4.17.3 bower_components/lodash

You can try to update your version of lodash through Bower to a version greater than 3.10.0. This should include the needed methods.