I have a indexpage as
<body ng-controller="MasterCtrl">
<div id="page-wrapper" ng-class="{'open': toggle}" ng-cloak>
<!-- Sidebar -->
<div id="sidebar-wrapper" ng-controller="SidebarCtrl">
<ul class="sidebar">
<li>
**<a href="#/nextpage?team={{department_name}}">Page Lik data <span class="menu-icon fa fa-road"></span></a>**
</li>
</ul>
</div>
</div>
<!-- Main Content -->
<div ui-view></div>
</body>
The employee data we are getting form http://localhost:3000/employees?employee_id=764967674 is
[
{
location: "BLR",
department: "Core",
designation: "desig",
name: "Mr X",
gender: "M",
employee_id: 764967674,
email: "thisidas@example.com",
mobile: 7654578882,
_id: "5atsda5sdasd",
}
]
sidebar_ctrl:
/**
* sidebar Controller
*/
angular.module('tool')
.controller('SidebarCtrl', ['$scope', '$cookieStore', 'Employee', '$window', '$stateParams', '$log', SidebarCtrl]);
function SidebarCtrl($scope, $cookieStore, Employee, $window, $stateParams, $log) {
$scope.emp_id = $stateParams.emp_id
if($scope.emp_id) {
var employee_Data = Employee.query({employee_id: $scope.emp_id}, function() {
$scope.department_name = employee_Data[0].department;
alert("asd");
});
}
}
employee service is
angular.module('PdbTool')
.factory('Employee', ['$resource', Employee]);
function Employee($resource) {
return $resource('localhost:3000/employees?', { employee_id: '@id' }, {
query: {method:'GET', isArray: true},
});
}
There is another ng-controller that is using the same service
/**
* Profile Controller
*/
angular.module('PdbTool')
.controller('ProfileCtrl', ['$scope', '$cookieStore', 'Employee', '$window', '$stateParams', '$log', ProfileCtrl]);
function ProfileCtrl($scope, $cookieStore, Employee, $window, $stateParams, $log) {
$scope.emp_id = $stateParams.emp_id
if($scope.emp_id) {
var entries = Employee.query({employee_id: $scope.emp_id}, function() {
$scope.emp_name = entries[0].name;
$scope.emp_department = entries[0].department;
$scope.emp_location = entries[0].location;
$scope.emp_designation = entries[0].designation;
$scope.emp_email = entries[0].email;
});
}
}
In the employee template html
<tr>
<th>Designation</th>
<td>{{emp_designation}}</td>
</tr>
<tr>
<th>Department</th>
<td>{{emp_department}}</td>
</tr>
The values are population but in the sidebar
Page Lik data
data is not displaying ? for url redirection