I am trying to access an object from a controller inside another controller. For example:
Controller 1
MyApp.controller('workController', function ($scope) {
$scope.xList = [
{name:'test', type:'web', link:'test', image:'iso.jpg'},
{name:'test', type:'web', link:'test', image:'iso.jpg'},
];
});
Controller 2: How to console.log an object from controller 1?
MyApp.controller('projectController', function ($scope) {
console.log('$scope.xList[1]);
});
I tried $scope.workController.xList[1] too but didn't work.
Please help