Skip to content
This repository was archived by the owner on Aug 6, 2020. It is now read-only.

Selecting Dates #66

Closed
alanTorresManci opened this issue Jul 19, 2016 · 16 comments
Closed

Selecting Dates #66

alanTorresManci opened this issue Jul 19, 2016 · 16 comments

Comments

@alanTorresManci
Copy link

im trying to use de multipledate picker, i have an event wich already has dates, how can i automaticlly show them on the callendar, ive allready tried with the ng-model and nothing appears there, when i use the selected-days attribute an error is shown in the console, it says that anngular has made too may loops and crashed

this is my tag
<multiple-date-picker ng-model="selectedDates"></multiple-date-picker>

this is where I add data
$scope.selectedDates = []; $scope.selectedDates.push(moment());

@mgohin
Copy link
Contributor

mgohin commented Jul 19, 2016

Hi,

you want to pre-select dates or you want to highlight some dates ?

Have you checked the demo ?

http://arca-computing.github.io/MultipleDatePicker/#ngmodel

The ngModel must be an array of moment dates.

@alanTorresManci
Copy link
Author

Im trying to pre select the dates, I`m using an older version,

@author : Maelig GOHIN For ARCA-Computing - www.arca-computing.fr
@Date: January 2016
@Version: 1.4.1

i read that i can use "daysSelected", and it works, but for some reason an error is shown on the console

@mgohin
Copy link
Contributor

mgohin commented Jul 19, 2016

Can you use the latest version?

@alanTorresManci
Copy link
Author

let me try

@alanTorresManci
Copy link
Author

i migrate to the next version, but the same error appears rootScope:infdig

@alanTorresManci
Copy link
Author

TypeError: daysSelected.map is not a function

@mgohin
Copy link
Contributor

mgohin commented Jul 20, 2016

Can you give me here your html and js code?
It's really difficult to help you without it

@alanTorresManci
Copy link
Author

alanTorresManci commented Jul 20, 2016

this is the implemented directive, it's inside of a ng-repeat
<multiple-date-picker selected-days="selectedDates" ng-model="selectedDates"></multiple-date-picker>

the js scope is $scope.selectedDates = [moment()];

in the moment that I changed the code to the latest version the console show this error, even when I dont put any attributes on the html code
captura de pantalla 2016-07-20 a las 8 59 07 a m

@mgohin
Copy link
Contributor

mgohin commented Jul 21, 2016

Ok, now you have the latest version, don't use selected-days use ng-model only

@jumph4x
Copy link

jumph4x commented Jul 24, 2016

Also experiencing this. It is Sunday here now and it just became a huge issue suddenly.

In my case using only <multiple-date-picker /> is enough to cause the error. No attributes, no nothing.

Moment 2.14. MDP 2.0.7. Also using moment-business-days.

@jumph4x
Copy link

jumph4x commented Jul 24, 2016

The infdig seems to be happening the template is being evaluated, this is one of the lines that shows up:

<div class="text-center picker-day {{getDayClasses(day)}}" title="{{day.title}}" ng-repeat="day in days" ng-click="toggleDay($event, day)" ng-mouseover="hoverDay($event, day)" ng-mouseleave="dayHover($event, day)">{{day ? day.mdp.otherMonth && !showDaysOfSurroundingMonths ? \'&nbsp;\' : day.date.format(\'D\') : \'\'}}</div>

The first line of the trace is the most helpful. Since we're using AJS 1.3, I believe we're seeing this: angular/angular.js#11315

The model is set to NaN and the Infinite Digest happens.

@mgohin
Copy link
Contributor

mgohin commented Jul 24, 2016

Could you provide me an example like on jsfiddle ?

@jumph4x
Copy link

jumph4x commented Jul 25, 2016

@mgohin Take a look here, one external CSS file links to our production file:

https://jsfiddle.net/jumph4x/0zc1q3sj/2/

@jumph4x
Copy link

jumph4x commented Jul 25, 2016

Here is one with the main JS file broken apart and separate dependencies:

https://jsfiddle.net/jumph4x/exsLngbh/1/

@jumph4x
Copy link

jumph4x commented Jul 25, 2016

And having done all that, it seems that going from AngularJS v1.3.0-beta.11 to AngularJS v1.3.0 solves the problem.

:)

@mgohin
Copy link
Contributor

mgohin commented Jul 26, 2016

So no more problem ? :)

@mgohin mgohin closed this as completed Jul 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants