angularjs - Binding model from controller -
how can binding model controller ?
here code
angular.module('elnapp') .controller('gridctrl', function ($scope, $http, $routeparams, $location, programservice) { $scope.gridoptions = { data: 'mydata', enablepaging: true, showfooter: true, totalserveritems:'totalserveritems', pagingoptions: $scope.pagingoptions, filteroptions: $scope.filteroptions, selecteditems: $scope.myselections, multiselect: false, afterselectionchange: function (data) { $scope.program = $scope.myselections[0]; $scope.program = $scope.myselections[0].programid; programservice.get({ id: $scope.program }, function (result) { data = { 'program': result }; }); $location.path('/program/edit/'+$scope.program); } };});
edit html
<form ng-submit="save()"> <input type="hidden" ng-model="program.program.programid"/> <dl> <dt>program name</dt> <dd><input name="programname" type="text" ng-model="program.program.programname"/></dd> <dt>program content</dt> </dl> <div class="form-actions"> <button type="submit">save</button> </div>
when select item after switch page edit html ,i can't bind model?
i confused , please help
<div>programname: {{program.program.programname}}</div>
Comments
Post a Comment