Search code examples
angularjsangularng2-bootstrap

Passing a notice of invalidation to ng2-bootstrap's Timepicker


I am using ng2-bootstrap's timepicker component. I have my own validation function triggered by the ngModelChange() event. Now the timepicker component itself has its own validators (such as when the model exceeds the mix/max values) and errors are shown using the .has-error class. If I am doing my own validation how do I notify the timepicker component that it is invalid?


Solution

  • Looking at the source of the component at https://github.com/valor-software/ng2-bootstrap/blob/development/components/timepicker/timepicker.component.ts, it has two public properties. Settings those should trigger the component showing an error or not.

      // validation
      public invalidHours:any;
      public invalidMinutes:any;