I'm having some weird problem here I have already declared a scope data in my main controller and can access it in every other controller except this child controller I just made, when I log/use $scope.user in the child controller the value is undefined
Main Controller
(function(){
angular.module('app.ctrls', []);
var app = angular.module('app.ctrls');
app.controller('mainCtrl', ["$scope", function($scope){
$scope.user = {
name:"John Doe",
id: 4
};
}]);
})();
Child Controller
(function(){
var app = angular.module("app.ctrls");
app.controller("childCtrl", ["$scope", function($scope){
console.log($scope.user);
}]);
})();
Route
var app = angular.modules("app.configs");
app.config(['$routeProvider', '$locationProvider', function (
$routeProvider, $locationProvider ) {
$routeProvider
.when('/settings/basic_info', {
templateUrl: 'basic_info_settings.html',
controller: 'childCtrl',
title: 'Basic Info - Settings | Knoweldge First'
})
}]);
View
<div ng-controller="mainCtrl" ng-view>
</div>