Please anyone tell me what am i missing or what is the actual issue that i am facing this problem.
Here is my controller.
app.controller('UpdateLeadController', ['$scope', '$http', '$location', '$route', 'ProgramsFactory', 'CommonFactory', '$filter', 'ProcessFactory', 'Upload', '$routeParams', function($scope, $http, $location, $route, ProgramsFactory, CommonFactory, $filter, ProcessFactory, Upload, $routeParams) {
$scope.limit = 3;
$scope.loadMore = function() {
$scope.limit += 2;
}
$scope.programIs = 1;
ProgramsFactory.Getprogramslist(1).then(function(response) {
$scope.programs = response.data.data;
});
CommonFactory.Getclients().then(function(response) {
$scope.clients = response.data.data;
});
ProgramsFactory.Getmonths().then(function(response) {
$scope.months = response.data.data;
});
ProcessFactory.Getlead($routeParams.id).then(function(response){
$scope.lead = response.data.data; // here i've got the lead data from factory.
});
console.log($scope); // when i am printing this scope i am getting the object lead with all data.
console.log($scope.lead); // when i am trying to print this. it outputs as `Undefined`.
}]);
I stuck on this issue. all data can be accessible in HTML but not able to get them in the controller as well as in directive. a directive is also giving data as undefined.
while printing scope i can see the object. but when i am trying to access that object it showing it's undefined.