This is a migrated thread and some comments may be shown as answers.

Selected value is not clearing with ng-if.

1 Answer 93 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
developer
Top achievements
Rank 1
developer asked on 27 Jul 2016, 12:16 PM

I'm having a functionality to load the DOM elements on demand. for that, I'm using ng-if the selected value is not clearing. Find the below example to reproduce the scenario.

Dojo

In this example, first control is with with "ng-if" and 2nd example with "ng-show". "ng-show" is working. But "ng-if" is not working. 

Please assist to fix the issue.

1 Answer, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 29 Jul 2016, 08:16 AM
Hello,

It seems that the specifics of ngIf directive, the first datepicker binds to a different $scope.dateFromObject instance, which prevents any subsequent model field modifications. The possible solutions in this case are:
  • use only ngShow directive, as it will keep the HTML rendered on the page
  • use "Ctrl as vm" to overcome the ngIf behavior - http://dojo.telerik.com/iqUvE

Regards,
Georgi Krustev
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
DatePicker
Asked by
developer
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or