Code Monkey home page Code Monkey logo

Comments (8)

indrimuska avatar indrimuska commented on June 15, 2024

Hi @AKFourSeven, this seems to be related to #17.
Have you already tried the latest version of Angular Moment Picker?

from angular-moment-picker.

akougblenou avatar akougblenou commented on June 15, 2024

Nope I haven't, I will try updating and keep in touch with you.

from angular-moment-picker.

akougblenou avatar akougblenou commented on June 15, 2024

Hi after updating I can confirm that the issue is different, the problem still remains. It seems as though the calendar has been updated as well as the input , something prevent to trigger the watches on the form to set the element (and thus the form) to dirty.
I have been using this plugin for a while and never experienced that before (it might be because I never confronted the case).

from angular-moment-picker.

indrimuska avatar indrimuska commented on June 15, 2024

Ok, let's take this plunker.

Angular does not unset $pristine property when a model has been changed through javascript, it sets the value to false only when a user interacts with a given input.
That being said, I think that the best solution for you is to set the pristine state by yourself when model changes, using the native angular api $setDirty():

$scope.$watch('myDate', function (myDate) {
   if (angular.isDefined(myDate)) {
      form.myDate.$setDirty();
   }
});

Check out this plunker: http://plnkr.co/edit/QhBoLzbHm48LGWrhhYb0?p=preview

from angular-moment-picker.

akougblenou avatar akougblenou commented on June 15, 2024

I see the angle you are tackling this from. But I cannot get the form object from within the link function.
I'll try to find a way to do that and post it here once I have found it, thanks for the tips though!

from angular-moment-picker.

indrimuska avatar indrimuska commented on June 15, 2024

If you have a directive with a link function maybe you need to check your scopes.
This is a very simple plunker that makes use of a directive with no private scope.

from angular-moment-picker.

indrimuska avatar indrimuska commented on June 15, 2024

I'm going to close this issue since it seems there's not due to Angular Moment Picker.
Feel free to reopen it if you find any problem.

from angular-moment-picker.

AgDude avatar AgDude commented on June 15, 2024

I haven't actually replicated this, but I am sure it is due to the fact that moment-picker does not use ngModel. ngModelCtrl methods handle setting pristine/dirty state.

from angular-moment-picker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.