I'm doing a simple controller to get some information from a server but, I don't know why is not working.
(function() {
'use strict';
var InvestorProfileApp=angular.module('InvestorProfileApp',['ngMaterial', 'ngMessages', 'material.svgAssetsCache',"xeditable", "ngMockE2E"])
InvestorProfileApp.controller('InvestorProfileCtrl', controller);
function controller($scope, $filter, $http) {
/*//$scope.photo_url = direccion+":"+puerto+localStorage.getItem(usuario);*/
$http.get(direccion + ":" + puerto + "/usr/1")
.success(function(data) {
})
.error(function(error){
console.log("Error: "+error);
});
$scope.currentNavItem = 'page1';
$scope.Account=
{
cashBalance: '$1,550',
equityBalance: '$620',
total: '$2,100'
}
;
$scope.RPerformance=
{
percentile:'70th',
}
;
$scope.GralInfo=[
{
}
];
$scope.user = {
lives: 'New York, NY',
employer: 'Nexxus Capital',
job: 'Financial Analyst',
studied:'Oxford University',
major:'Finance',
risk: 'High'
};
$scope.saveUser = function() {
// $scope.user already updated!
return $http.post('/saveUser', $scope.user).error(function(err) {
if(err.field && err.msg) {
// err like {field: "name", msg: "Server-side error for this username!"}
$scope.editableForm.$setError(err.field, err.msg);
} else {
// unknown error
$scope.editableForm.$setError('name', 'Unknown error!');
}
});
};
$scope.goto = function(page){
$scope.currNavItem = page;
};
};
})();
I used this code in other controllers and it works fine, ut with this I get the next error
Error: Unexpected request: GET http://35.161.59.162:4040/usr/1
No more request expected
at $httpBackend (angular-mocks.js:1420)
at sendReq (angular.js:11517)
at serverRequest (angular.js:11227)
at processQueue (angular.js:15961)
at angular.js:15977
at Scope.$eval (angular.js:17229)
at Scope.$digest (angular.js:17045)
at Scope.$apply (angular.js:17337)
at bootstrapApply (angular.js:1749)
at Object.invoke (angular.js:4665)
Hope you can help me. Thank you.