angularjs routing with object pass -
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 angular js controller:
.when('/edit/:id', { templateurl: basesiteurlpath + 'templates/hrm_dept/edit.html', controller: 'deptctrl' }) $scope.deptview = function (dept) { console.log(dept); $scope.dept1 = angular.copy(dept); var id = 1; var earl = '/edit/' + id; $location.path(earl); };
my list template :
ng-click="deptview(dept)"
my view template:
ng-model="dept1.dept_name"
for code should this
listcontroller.js
bring list db , give listcontroller.html
in listcontroller.html should contain links
<a ng-href="#/edit/{{project.$id}}"><i class="icon-pencil"></i></a> <a ng-href="#/edit/{{project.$id}}"><i class="icon-pencil"></i></a> <a ng-href="#/edit/{{project.$id}}"><i class="icon-pencil"></i></a>
router
.when('/edit/:projectid', { controller:'detailcontroller', templateurl:'detailcontroller.html' })
detailcontroller.js
.controller('detailcontroller',function($location, $route){ var projectid = $route.projectid, //getdatabyidfromdb $http.get('sales/getsalesbyid?id=' + projectid).then(function(response) { populate result in html }); });
fore more reference refer angularjs wire backend
Comments
Post a Comment