-1
이것은 아마도 쉽고 바보 같은 오류 일 수 있습니다. 그러나 어떤 이유로 Ajax 호출을 사용하여 작성한 배열에서 항목을 제거 할 수 없습니다. 나는 그것을 제거하려고하면 내가 얻을이 오류 JS : 여기 각도 배열에서 항목을 제거 할 수 없습니다.
TypeError: undefined is not a function
at h.$scope.remove (https://www.skykick.com/cmsctx/pv/mhintzke/culture/en-US/wg/725a2fa0-45ad-4…d7912fdf1/-/cms/getdoc/468aee97-0186-4241-b599-22e97438dcfa/pv.aspx:190:31)
at bb.functionCall (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js:174:190)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js:191:167
at h.$get.h.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js:111:121)
at h.$get.h.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js:111:399)
at HTMLTableRowElement.<anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js:191:149)
at HTMLTableRowElement.jQuery.event.dispatch (https://www.skykick.com/CMSScripts/jquery/jquery-core.js:3350:9)
at HTMLTableRowElement.jQuery.event.add.elemData.handle.eventHandle (https://www.skykick.com/CMSScripts/jquery/jquery-core.js:2959:45)
이 원인 코드가 그것을
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Test.ascx.cs" Inherits="CMSApp.CMSWebParts.SkyKick.PartnerPortalV2.Web_Planner.Test" %>
<div ng-app="Skykick" ng-controller="MainCtrl">
<div class="dashSection">
<table id="tActivities" class="activityTable">
<caption>Recently</caption>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody id="tbActivities">
<tr ng-repeat="activity in activities" ng-click="remove(activity)">
<td>{{ activity.Description }}</td>
<td>{{ activity.Count }}</td>
<td>{{ activity.CustomerName }}</td>
<td>{{ activity.Date }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular-route.min.js"></script>
<script type="text/javascript">
var app = angular.module('Skykick', ['ngRoute'])
app.controller('MainCtrl', function ($scope, $http) {
$scope.activities = new Array();
$scope.remove = function (activity) {
console.log(activity);
$scope.activities.remove(activity);
}
$http({
method: 'GET',
url: 'https://www.skykick.com/WebApi/activity/recent/all'
})
.success(function (data, status) {
$scope.activities = data.result.Activity;
})
.error(function (data, status) {
console.log(data);
alert("error");
});
});
</script>
JavaScript에 내장 된 .remove() 속성이 없습니다. –
오 와우, idk 내가 그때 생각했던 것 ... –
방금이 대답을했습니다. 다행히 도울 수있어. –