Reputation: 119
I am using a datepicker control on my page which is rendered through ng-if dependent on a specific dropdown value.
The problem I'm facing is since at the time of rendering, that datepicker input is not part of DOM, so later when I change the value of dropdown, the datepicker control does not work.
If I use ng-show, I encounter issues in validations.
Any suggestions?
Thanks.
Upvotes: 2
Views: 196
Reputation: 38683
Use ng-show/ng-hide
instead of ng-if
, because the ng-if
directive removes or recreates a portion of the DOM tree based on an expression. If the expression assigned to ng-if
evaluates to a false value then the element is removed from the DOM, otherwise a clone of the element is reinserted into the DOM.
More details. please refer this link : what is the difference between ng-if and ng-show/ng-hide
Upvotes: 1