I am currently working on customizing the angular-pickdate module from https://github.com/jimibi/angular-pickadate to meet my specific requirements. However, I have hit a roadblock because I am unable to make a GET request in the traditional way that I am accustomed to.
Below is a snippet of my code: ...
.directive('pickadate', ['$locale', 'pickadateUtils', 'pickadateI18n', 'dateFilter', function($locale, dateUtils, i18n, dateFilter) {
return {
require: 'ngModel',
scope: {
date: '=ngModel',
defaultDate: '=',
minDate: '=',
maxDate: '=',
disabledDates: '='
},
template:
...,
link: function(scope, element, attrs, ngModel,$http) {
var minDate = scope.minDate && dateUtils.stringToDate(scope.minDate),
maxDate = scope.maxDate && dateUtils.stringToDate(scope.maxDate),
disabledDates = scope.disabledDates || [],
currentDate = (scope.defaultDate && dateUtils.stringToDate(scope.defaultDate)) || new Date();
scope.dayNames = $locale.DATETIME_FORMATS['SHORTDAY'];
scope.currentDate = currentDate;
scope.t = i18n.t;
scope.render = function(initialDate,$http) {
initialDate = new Date(initialDate.getFullYear(), initialDate.getMonth(), 1, 3);
$http({url: 'myplace/script_lotacoes.php', method: 'GET'}).success(function(){alert("hheheh");}).error(function(){alert("oops");});
...
The error message I encounter with this code is as follows:
TypeError: undefined is not a function
at Scope.angular.module.provider.factory.directive.link.scope.render (angular-pickadate.js:122)
at angular.module.provider.factory.directive.link.ngModel.$render (angular-pickadate.js:191)
at Object.ngModelWatch (ionic.bundle.js:31576)
at Scope.$get.Scope.$digest (ionic.bundle.js:22518)
at Scope.$get.Scope.$apply (ionic.bundle.js:22789)
at done (ionic.bundle.js:17942)
at completeRequest (ionic.bundle.js:18132)
at XMLHttpRequest.requestLoaded (ionic.bundle.js:18073)
This issue seems to be directly linked to the $http request.
If anyone has insights into why this error occurs and how it can be resolved, your assistance would be greatly appreciated! Thank you in advance.