Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在AngularJs范围内推送数据的正确方法_Angularjs_Angularjs Scope - Fatal编程技术网

在AngularJs范围内推送数据的正确方法

在AngularJs范围内推送数据的正确方法,angularjs,angularjs-scope,Angularjs,Angularjs Scope,这是我的作用域格式 $scope.order.Transaction{ 'source': value, 'fees': value, 'ref':value } 我如何将上述数据推送到现有的$scope中,有人能为我指明正确的方向吗?这是$scope.order.Transaction已经包含的内容: 对象{来源:“价值”,费用:“33”,参考:“37226”} 我想向它推送一个新对象。怎么做?这是一个javascript的东西,而不是一个角度 $sco

这是我的作用域格式

    $scope.order.Transaction{
    'source': value,
    'fees': value,
    'ref':value
   }
我如何将上述数据推送到现有的$scope中,有人能为我指明正确的方向吗?这是$scope.order.Transaction已经包含的内容: 对象{来源:“价值”,费用:“33”,参考:“37226”}
我想向它推送一个新对象。怎么做?

这是一个javascript的东西,而不是一个角度

$scope.order.Transaction.source = 'someValue'
$scope.order.Transaction.fees = 'someValue'
$scope.order.Transaction.ref = 'someValue'

这是JavaScript,与Angular无关。需要更多信息才能提供帮助。现有交易是什么?它是一个对象数组吗?您正在尝试添加(推送)新对象吗?我已经添加了更多信息,谢谢
$scope.order.Transactions = [];

$scope.order.Transaction = {
    'source': value,
    'fees': value,
    'ref':value
};

$scope.order.Transactions.push($scope.order.Transaction);