这个mycode,我尝试在company1的工作人员中重视,但它创建了一个新的数组列表。有人能帮助我吗?
在我添加人员的名称和ID后,数组将如下所示
[{companyName:" company1&#34 ;, companyAddress:"公司地址",员工: [{name:" men",id:" 123"},{name:" boy",id:" 1343"},{名:"约翰",ID: " 145"}]}]
<div ng-controller="MyCtrl">
<input type="text" ng-model="nameStaff" />
<input type="text" ng-model="idStaff" />
<button ng-click=addDetail()>add</button>
{{form}}
</div>
var myApp = angular.module('myApp', []);
function MyCtrl($scope) {
$scope.form = [{ companyName: "company1", companyAddress: "company address", staff: [{ name: "men", id: "123" }] }];
$scope.addDetail = function() {
$scope.form.push({ staff: [{ name: $scope.nameStaff, id: $scope.idStaff }] });
}
}
答案 0 :(得分:1)
您正在推进[y1,fs1] = audioread(myfile1);
[y2,fs2] = audioread(myfile2);
,但您希望继续form
中第一个对象的staff
:
form