ionic-datepicker - How to render after $ http?

0

Good afternoon.

Next ... I'm not sure if my question is about Ionic or AngularJs.

I'm implementing the code below

$scope.datepickerObject = {
              titleLabel: 'Escolha a Data',  //Optional
              todayLabel: 'Hoje',  //Optional
              closeLabel: 'Fechar',  //Optional
              setLabel: 'Ok',  //Optional
              setButtonType : 'button-assertive',  //Optional
              todayButtonType : 'button-assertive',  //Optional
              closeButtonType : 'button-assertive',  //Optional
              inputDate: new Date(),  //Optional
              mondayFirst: true,  //Optional
              disabledDates: arDatas, //Optional
              weekDaysList: '', //Optional
              monthList: '', //Optional
              templateType: 'modal', //Optional
              showTodayButton: 'true', //Optional
              modalHeaderColor: 'bar-positive', //Optional
              modalFooterColor: 'bar-positive', //Optional
              from: new Date(), //Optional
              to: new Date(2018, 8, 25),  //Optional
              callback: function (val) {  //Mandatory
                datePickerCallback(val);
              },
              dateFormat: 'dd-MM-yyyy', //Optional
              closeOnSelect: true, //Optional
            };


            var datePickerCallback = function (val) {
          if (typeof(val) === 'undefined') {
            console.log('No date selected');
          } else {
            console.log('Selected date is : ', val)
            $scope.dataConsulta = val.toISOString().slice(0,10);
            this.dataConsulta = val.toISOString().slice(0,10);
          }
        };

If I put this in JS, it works wonder, but if I put this inside a $ http, it does not work. I do not know how to render this object after Ajax finishes.

    
asked by anonymous 23.02.2016 / 19:35

0 answers