Git Product home page Git Product logo

Comments (6)

torabian avatar torabian commented on August 23, 2024

Can you provide us a little bit of more details, provide code that we can reproduce.

from amazing-time-picker.

bam-dreymers avatar bam-dreymers commented on August 23, 2024

[Updated]

I added a new pull request to fix this - all changes are in the AtpDirective file:
https://github.com/owsolutions/amazing-time-picker/pull/51/files

I read this blog and basically just applied it to the directive: https://blog.angularindepth.com/never-again-be-confused-when-implementing-controlvalueaccessor-in-angular-forms-93b9eee9ee83

from amazing-time-picker.

shanthece avatar shanthece commented on August 23, 2024

having same issue in reactive forms, even after followed bam-dreymers answers

from amazing-time-picker.

torabian avatar torabian commented on August 23, 2024

I have merged the code since all builds are passing and there is no backward compatibility issue.
This will be available after 1.5.0 version, probably by 03 of March, when we deploy to npm.

Please open a new issue, if you still having problems for this.

from amazing-time-picker.

Beni90 avatar Beni90 commented on August 23, 2024

Hi guys, just installed the time-picker and have this problem as well. Formfield value is not updated in the component.

When is this going to be fixed?

from amazing-time-picker.

ugiordan avatar ugiordan commented on August 23, 2024

@Beni90 you have two options to make it works:

  1. Applying the "atp-time-picker" directive to the input field, e.g.:
<label for="time_picker" class="control-label">Time Picker</label>
<input id="time_picker" formControlName="time_picker" type="time" atp-time-picker>
  1. Setting the value of the corresponding form control. This is my case, where I had and input group (input field + button) and want to make both the input and the button opening the time-picker
@Component({
  selector: 'form-time-picker',
  styleUrls: ['./form-time-picker.component.scss'],
  template: `
    <ng-container [formGroup]="formGroup">
     <label for="time_picker" class="control-label">Time Picker</label>
     <div class="input-group mb-2" id="time_picker" (click)="open()">
        <input id="time_picker"
               formControlName="time_picker"
               type="time"
               value="{{selectedTime}}"/>
        <div class="input-group-append">
          <button type="button" class="btn btn-primary btn-icon input-group-text">
            <i class="ion-ios-time-outline"></i>
          </button>
        </div>
      </div>
    </ng-container>
  `,
})
export class FormTimePickerComponent {
  @Input()
  formGroup: FormGroup;

  @Input()
  config: TimePickerConfig;

  selectedTime: string;

  constructor(private atp: AmazingTimePickerService) {
  }

  open() {
    const timePicker = this.atp.open(this.config.pickerConfig);

    timePicker.afterClose().subscribe(time => {
      this.selectedTime = time;
      this.formGroup.controls[this.config.name].setValue(time);
    });
  }

}

from amazing-time-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.