私は、syncfusionとscheduleコンポーネントでAngular JSを使用しています。私はasp.netコアで作られた残りのAPIを持っており、私はそれをangeljsでクライアントにしました。私はスケジュールコンポーネントのすべての予定を取得しようとしていますが、スケジュールにバインドするスコープ変数にそれらを割り当てると、エラーが発生します。私はこのエラーをグーグルで試してみましたが、有用なものは何も見つかりませんでした。角度やjavascriptにはあまり習熟していません。n.sortは関数エラーではありません
私はアポイントメントオブジェクトを使用して配列を手動で作成すると機能しますが、アポイントサービスから渡したときは機能しません。
これはエラーです:
angular.js:14525 TypeError: n.sort is not a function
at Object._sortAppById (http://cdn.syncfusion.com/15.1.0.41/js/web/ej.web.all.min.js:10:3533264)
at Object._dataProcessing (http://cdn.syncfusion.com/15.1.0.41/js/web/ej.web.all.min.js:10:3536745)
at Object._bindAppointmentsData (http://cdn.syncfusion.com/15.1.0.41/js/web/ej.web.all.min.js:10:3529006)
at Object._init (http://cdn.syncfusion.com/15.1.0.41/js/web/ej.web.all.min.js:10:3298250)
at Object.<anonymous> (http://cdn.syncfusion.com/15.1.0.41/js/web/ej.web.all.min.js:10:21539)
at r.fn.init.n.fn.(anonymous function) [as ejSchedule] (http://cdn.syncfusion.com/15.1.0.41/js/web/ej.web.all.min.js:10:22796)
at Object.post (http://cdn.syncfusion.com/15.1.0.41/js/common/ej.widget.angular.min.js:10:9542)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:17:3
at ra (https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:85:35)
at n (https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:70:226) "<ej-schedule id="Schedule1" e-width="100%" e-height="525px" e-currentview="currentView" e-currentdate="Date" e-appointmentsettings-datasource="appointments" e-appointmentsettings-id="id" e-appointmentsettings-subject="name" e-appointmentsettings-starttime="startTime" e-appointmentsettings-endtime="endTime" e-appointmentsettings-description="comments" e-appointmentsettings-allday="isAllDay" e-appointmentsettings-recurrence="isRecurrence" e-appointmentsettings-recurrencerule="recurrenceRule" e-directive-name="ejSchedule" class="e-schedule e-js e-scheduleouter e-tooltip" tabindex="1" style="width: 100%; height: 525px;" role="presentation">"
これは、コントローラ内のサービスからそれらを得るために、私の関数である: `
appointmentsService.getAppointments().then(function (results) {
$scope.appointments = results.data;
console.log($scope.appointments);
});
と、これは私のサービスである:
(function() {
'use strict';
var app = angular.module("myApp");
app.factory('appointmentsService', ['$http', function($http) {
var serviceBase = 'http://localhost:63185/';
var appointmentsServiceFactory = {};
var _getAppointments = function() {
return $http.get(serviceBase + 'api/appointments').then(function (results) {
return results;
});
};
appointmentsServiceFactory.getAppointments = _getAppointments;
return appointmentsServiceFactory;
}]);
}());