Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when injecting restangular with angular 1.6.4 #1470

Open
andersonxf opened this issue Apr 24, 2017 · 2 comments
Open

Error when injecting restangular with angular 1.6.4 #1470

andersonxf opened this issue Apr 24, 2017 · 2 comments

Comments

@andersonxf
Copy link

I'm trying to use the rectangle but when injecting the same it gives the following error:
Uncaught Error: [$injector:modulerr] Failed to instantiate module myapp due to:
Error: [$injector:modulerr] Failed to instantiate module restangular due to:
TypeError: Cannot read property 'isUndefined' of undefined
at Object.Configurer.init (http://localhost:63342/teste-ecentry/bower_components/restangular/dist/restangular.js:42:29)
at new (http://localhost:63342/teste-ecentry/bower_components/restangular/dist/restangular.js:812:16)
at Object.instantiate (http://localhost:63342/teste-ecentry/bower_components/angular/angular.js:5018:14)
at provider (http://localhost:63342/teste-ecentry/bower_components/angular/angular.js:4826:36)
at Object.provider (http://localhost:63342/teste-ecentry/bower_components/angular/angular.js:4818:16)
at runInvokeQueue (http://localhost:63342/teste-ecentry/bower_components/angular/angular.js:4890:35)
at http://localhost:63342/teste-ecentry/bower_components/angular/angular.js:4899:11
at forEach (http://localhost:63342/teste-ecentry/bower_components/angular/angular.js:403:20)
at loadModules (http://localhost:63342/teste-ecentry/bower_components/angular/angular.js:4880:5)
at http://localhost:63342/teste-ecentry/bower_components/angular/angular.js:4898:40

The app.js file is like so:
(function(){
'use strict';
angular
.module('myapp',['ngRoute', 'restangular','angularUtils.directives.dirPagination']);
})()

my controller:

(function(){
'use strict';

angular
.module('myapp')
.controller('contatoController', contatoController);

contatoController.$inject = ['contatoAPI','$scope','$location'];

function contatoController(contatoAPI,$scope, $location, Restangular ){

    $scope.getContato = function(){
		contatoAPI.getContato()
			.then(function(reponse){
				console.log(response)				
		},function (response) {
                console.log(response)

        });
	}       
}

})()

These are my dependencies:
"dependencies": {
"bootstrap": "~3.3.5",
"angularUtils-pagination": "angular-utils-pagination#^0.11.1",
"angular": "^1.6.4",
"angular-route": "^1.6.4",
"restangular": "^1.6.1"
}

As it is the first time that I use this library, I would like the help of someone.

@ghost
Copy link

ghost commented Apr 28, 2017

including the underscore js, which is a dependency of restangular, must resolve it

@PapyElGringo
Copy link

PapyElGringo commented Jul 11, 2017

It's not, Any idea?

Edit:

You have to import Lodash before Restangular inside your index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants