We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

can't get appointments to work from api service

I'm using Angular JS with schedule component. I have a rest api made in asp.net core and I made a client for it in angularjs. I'm trying to get all appointments for the schedule component, however when assigning them to the scope variable that binds to schedule it comes up with an error. I tried googling this error however I haven't found anything useful and I'm not very proficient in angular or javascript yet.When I make an array with appointment objects manually it works, but when I passed it from my appointments service it doesn't. (Also, a bit offtopic but how would I perform CRUD actions for the schedule? Would I use events like "onAppointmentSave" ?)This is the error: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. (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) ""This is my function to get them from service in controller:appointmentsService.getAppointments().then(function (results) { $scope.appointments = results.data; console.log($scope.appointments); });and then this is my service:(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; }]); }());

2 Replies

PK Piotr Kujawski May 10, 2017 07:59 AM UTC

Anyone? Please


KK Karthigeyan Krishnamurthi Syncfusion Team May 10, 2017 11:27 AM UTC

Hi Piotr,  
 
Thank you for contacting Syncfusion support. 

We have created an incident for your query and we request you to have a follow up with the below incident link for further update on this. 
 
Regards, 
Karthigeyan 


Loader.
Live Chat Icon For mobile
Up arrow icon