如何更新角度js中的选择框数据

时间:2015-12-31 06:07:27

标签: javascript php mysql angularjs

嗨,我想要的是从angularjs中的selectbox中选择一个值,并在数据库中更新该值我在json数组中获取数据 来自php函数和mysql数据库:保持更新的值将在selectbox中显示为默认值 注意:您必须仅定位选择框



<table>
<tr ng-repeat="user in $data | filter:searchText">
               
               <td data-title="'pkCategoryId'" >{{$index + 1}}</td>
               <td data-title="'Name'" >{{user.Name}}</td>
              <!--  <td data-title="'Order'">{{user.Order}}</td> -->
                <td> <select class="form-control input-sm" ng-model="rec.orders"  name="Order">
      <option ng-repeat="orders in order" 
      ng-selected="{{orders.Order == user.Order}}"  value="{{orders.order}}">{{orders.Order}}      </option>
                                  </select> </td>
               <td data-title="'Status'">{{user.Status}}</td>   
               <td><button class="btn btn-sm btn-info"  title="SEO" ui-sref="app.seomanage_category({id:user.pkCategoryId})">  
                    <em class="fa fa-search"></em>
                </button> </td>           
              
            </tr>
         
      </table>
&#13;
&#13;
&#13; 这是我的js

&#13;
&#13;
 $scope.updateValue(rec){

 	$scope.upload = $upload.upload({
			//url: 'api/manage_features/update/'+id, //upload.php script, node.js route, or servlet url 
			url: 'api/AdminArea/category/updateValue/'+id,
			method: 'POST', 
			headers: {'header-key': '83c238df1650bccb2d1aa4495723c63f07672ee8'}, 
			withCredentials: true, 
			data:rec , //{data:rec},
			//data: {name:$scope.name,price:$scope.price},
		  }).progress(function(evt) {
			console.log('percent: ' + parseInt(100.0 * evt.loaded / evt.total));
		  }).success(function(data, status, headers, config) {
					 toaster.pop('success', 'Order', 'Order Updated successfully.');
					   setTimeout(function(){ $state.go('app.manage_category'); }, 3000);
					 $scope.$root.$broadcast("myDocEventReload", {});
		  })
	
 }
&#13;
&#13;
&#13;

任何帮助都将不胜感激。

0 个答案:

没有答案