我在Laravel Blade中有一张表,该表已初始化一个值,我想在控制器中访问该值,以便发送给函数进行API调用。问题是我如何访问发送的ID
app.controller('MyController', ['$scope', 'MyCall','id','TableState', function ($scope, MyCall, id,TableState) {
$scope.displayed = [];
$scope.callServer = function callServer(tableState)
{
return TableState.renderTable($scope, tableState, MyCall.getRecipientCalls(tableState, $scope.id));
};
}]
);
我的刀片代码;
<div ng-controller="MyController" ng-init="id ='{!! $mycalls->id !!}'">
想要将ID从上方传递给控制器,并在 getRecipientCalls 函数中查看...
答案 0 :(得分:0)
使用 $ scope
解决return TableState.renderTable($scope, tableState, MyCall.getRecipientPositions(tableState, $scope.id));
并删除属性中的呼叫;
app.controller('MyController', ['$scope', 'MyCall','TableState', function ($scope, MyCall,TableState) {