Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second open of date picker throws an error #450

Closed
kuceram opened this issue Apr 7, 2016 · 19 comments
Closed

Second open of date picker throws an error #450

kuceram opened this issue Apr 7, 2016 · 19 comments

Comments

@kuceram
Copy link

kuceram commented Apr 7, 2016

angular-bootstrap: 0.13.4
angular: 1.4.0
angular-xeditable: 0.1.11

Having this code:

<small editable-bsdate="myDate"
             e-name="my-date" e-datepicker-popup="dd/MM/yyyy" e-init-date="false"
             e-is-open="data.isOpen" e-ng-click="data.isOpen = true">
     {{myDate | date) || 'empty'}}
</small>

I can open a bootstrap date picker. However, when I close it and open it again it fires an exception somewhere in angular ui bootstrap (some focus function). It shows the datepicker anyway. This happens even if I set e-on-open-focus="false".

I have a suspicion, that bootstrap date picker is rendered twice by xeditable directive.

@ckosloski
Copy link
Contributor

I think this can be fixed by adding the following to the UibDatepickerPopupController:

$element.on('$destroy', function() {
      $scope.$destroy();
     });

I have opened an issue with ui-bootstrap

@geostima
Copy link

tried this hack by modifying the actual UibDatepickerPopupController - didn't work.

@ckosloski
Copy link
Contributor

Here is a plunkr that shows the fix working.

Do you have an example of the fix not working?

@jobski
Copy link

jobski commented Apr 15, 2016

@ckosloski Tried your fix but as @geostima said, it didn't work.

When I open the datepicker for the second time, I get these errors in chrome:

Error: [$compile:ctreq] http://errors.angularjs.org/1.5.3/$compile/ctreq?p0=ngModel&p1=uibDatepicker at Error (native) at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:6:416 at jb (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:70:406) at jb (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:70:473) at n (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:65:259) at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:76:125 at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:58:140) at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:57:281 at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:62:133 at d (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:59:122) <li ng-transclude="">(anonymous function) @ angular.js:13424(anonymous function) @ angular.js:10137ja @ angular.js:9625n @ angular.js:9022g @ angular.js:8333n @ angular.js:9017g @ angular.js:8333(anonymous function) @ angular.js:8213(anonymous function) @ angular.js:8551d @ angular.js:8350l @ angular.js:9072(anonymous function) @ angular.js:25323m.$digest @ angular.js:16869m.$apply @ angular.js:17133(anonymous function) @ angular.js:24813n.event.dispatch @ jquery.min.js:3r.handle @ jquery.min.js:3 angular.js:13424 TypeError: Cannot read property 'getFullYear' of undefined at _refreshView (https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.3.2/ui-bootstrap-tpls.min.js:7:25823) at refreshView (https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.3.2/ui-bootstrap-tpls.min.js:7:22763) at init (https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.3.2/ui-bootstrap-tpls.min.js:7:25624) at link (https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.3.2/ui-bootstrap-tpls.min.js:7:29743) at ja (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:80:35) at n (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:65:220) at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:76:125 at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:58:140) at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:57:281 at d (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:59:122) <table class="uib-daypicker" role="grid" aria-labelledby="{{::uniqueId}}-title" aria-activedescendant="{{activeDateId}}" ng-switch-when="day" tabindex="0">(anonymous function) @ angular.js:13424(anonymous function) @ angular.js:10137ja @ angular.js:9625n @ angular.js:9022(anonymous function) @ angular.js:9380g @ angular.js:8333(anonymous function) @ angular.js:8213d @ angular.js:8350l @ angular.js:9072(anonymous function) @ angular.js:29434q @ angular.js:321(anonymous function) @ angular.js:29433m.$digest @ angular.js:16869m.$apply @ angular.js:17133(anonymous function) @ angular.js:24813n.event.dispatch @ jquery.min.js:3r.handle @ jquery.min.js:3

TypeError: Cannot read property 'getFullYear' of undefined at _refreshView (https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.3.2/ui-bootstrap-tpls.min.js:7:25823) at refreshView (https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.3.2/ui-bootstrap-tpls.min.js:7:22763) at init (https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.3.2/ui-bootstrap-tpls.min.js:7:25624) at link (https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.3.2/ui-bootstrap-tpls.min.js:7:29743) at ja (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:80:35) at n (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:65:220) at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:76:125 at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:58:140) at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:57:281 at d (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js:59:122) <table class="uib-daypicker" role="grid" aria-labelledby="{{::uniqueId}}-title" aria-activedescendant="{{activeDateId}}" ng-switch-when="day" tabindex="0">(anonymous function) @ angular.js:13424(anonymous function) @ angular.js:10137ja @ angular.js:9625n @ angular.js:9022(anonymous function) @ angular.js:9380g @ angular.js:8333(anonymous function) @ angular.js:8213d @ angular.js:8350l @ angular.js:9072(anonymous function) @ angular.js:29434q @ angular.js:321(anonymous function) @ angular.js:29433m.$digest @ angular.js:16869m.$apply @ angular.js:17133(anonymous function) @ angular.js:24813n.event.dispatch @ jquery.min.js:3r.handle @ jquery.min.js:3

@Sampath-Lokuge
Copy link

Sampath-Lokuge commented May 9, 2016

Thanks @ckosloski .Your solution is working 😄

@anthony-foulfoin
Copy link

Same problem for me : there is no error thrown, but the second time I try to edit a date field, the input field becomes empty.

@ckosloski
Copy link
Contributor

Try using the latest release (0.2.0). It looks like #489 might have fixed the issues.

@kuceram kuceram closed this as completed Jul 20, 2016
@kuceram kuceram reopened this Jul 20, 2016
@kuceram
Copy link
Author

kuceram commented Jul 20, 2016

Upgrading the plugin, I could not open the date picker at all. It just doesn't work and it doesn't throw any error. However for latest angular bootstrap it works, see #466

@ckosloski
Copy link
Contributor

What version of bootstrap where you using when it didn't work?
Do you have a jsfiddle or plunkr showing your issue?

@kuceram
Copy link
Author

kuceram commented Jul 20, 2016

The setup was:
angular-bootstrap: 0.13.4
angular: 1.4.10
angular-xeditable: 0.2.0

but maybe we can close it as it works with the newest version of angular-bootstrap...

@ckosloski
Copy link
Contributor

Yes, the current version of xeditable requires angular-ui-bootstrap 1.0.0 or higher. In version 1.0.0 they renamed many of the directives and xeditable was updated to work with these new directive names.

@kuceram
Copy link
Author

kuceram commented Jul 21, 2016

ok, make sense...thanks anyway.

@kuceram kuceram closed this as completed Jul 21, 2016
@afgonzal
Copy link

@ckosloski the demo and your plunkr have the same issue, the styles of the datepicker are wrong (looks huge etc)
like it´s ignoring the boostrap styles for the picker

@ckosloski
Copy link
Contributor

Yes, I am aware of the issue. The issue is fixed and merged, but not yet released.

@afgonzal
Copy link

Great, is that version downloadable?

@ckosloski
Copy link
Contributor

You would have to download the source code and build it yourself.

@afgonzal
Copy link

sure, np, is it under github?
link?

thanks

@ckosloski
Copy link
Contributor

https://github.com/vitalets/angular-xeditable
Clone or download link.

@eugef
Copy link
Collaborator

eugef commented Sep 21, 2016

@afgonzal you can try the latest release 0.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants