when click on view button department list data not showing on view template. not using service. please me someone.........
my source code given below ......
my angularjs controller:
.when('/edit/:id', { templateurl: basesiteurlpath + 'templates/hrm_dept/edit.html', controller: 'deptctrl' })
deptapp.controller('deptctrl', function ($scope, $routeparams, $location, $route) {
$scope.dept = {}; $scope.dept1 = {}; $scope.deptlist = []; $scope.deptlist1 = []; $scope.ishide = true; $scope.deptview = function (dept) { console.log(dept); **$scope.dept1 = angular.copy(dept);** var id = 1; **var earl = '/edit/' + id;** $location.path(earl); $scope.$apply(); }; });
here list template: ng-click="deptview(dept)"
here view template: dept name: ng-model="dept1.dept_name"
try following (don't forget declare $http
in controller)
$http.get('/hrm_dept/getalldepartment'). success(function(data, status, headers, config) { $scope.deptlist = data; // callback called asynchronously // when response available }). error(function(data, status, headers, config) { // called asynchronously if error occurs // or server returns response error status. });
Comments
Post a Comment