luisfarzati / ng-bs-daterangepicker

AngularJS directive for bootstrap-daterangepicker
http://luisfarzati.github.io/ng-bs-daterangepicker/
MIT License
246 stars 167 forks source link

it is not updating start date and end date in input text while updating model manually. it seems $watch on model is not working. angular version 1.4.3 i am using. #80

Open vinaykevadia opened 9 years ago

ivkremer commented 9 years ago

I suppose this is a bug and what is needed is a manual ngModel.$render(); call after value initialization by directive itself (after line 70). @luisfarzati I'm going to submit a pull request.

djheart0710 commented 9 years ago

@ivkremer @luisfarzati Hi, my angular version is 1.2.16. When I use ng-bs-daterangepicker, I encounter a problem and i can't get correct daterange, the result in input filed is [object object]. Then I find your submit, and I comment "ngModel.$render()", then it works. I think it's strange, and it may relate to angular's version. What do you think about it? AND thanks for your contribution.

ivkremer commented 9 years ago

@djheart0710 I'm not sure because I didn't participate in this directive development but I consider direct $render() call there is required since it's set manually and not parsed or rendered so as for me it's not so strange. Didn't know about angular v1.2.16, the behaviour is different but still is buggy.

djheart0710 commented 9 years ago

@ivkremer What I mean about the strange thing is the result and behavior I got, not the statement you add. The method you add is reasonable, but it fails in my project. I get something when I go through the code, but I'm not sure about it. I need sometime to verify it.

ivkremer commented 9 years ago

@djheart0710 Ok, I got your idea. Actually I failed with testing and didn't understand that my fix is not working for an older version at least for v1.2.16 resulting in [Object object] in the input. To fix this just try to add priority: 1, to directive's options, like:

restrict: 'E',
priority: 1,
require: '?ngModel',
link: function(...) {
...
riturajratan commented 9 years ago

can you update this in your code. So it will helpful for people, when they use bower install .

kenjfg commented 7 years ago

I cannot update the model after I make a request to the server and fill the date object with the new dates. It's show [object Object]. This is the directive:

/**

})(angular);