Closed chocapic54 closed 8 years ago
Hi bro' !
When I try with the demo, I've got the same problem.
I don't understand why...
it must be due to the new @angular/forms
I've seen that a PR has just been validated by @nkalinov today https://github.com/nkalinov/ng2-datetime/pull/26 But the package has not been yet published to NPM
Do you know when it will @nkalinov ?
My Component
import { NKDatetime } from 'ng2-datetime/ng2-datetime';
import { DatePipe } from '@angular/common';
@Component({ ... directives: [NKDatetime], pipes : [DatePipe] })
export class ParameterListComponent {
public parameterFilter : ParameterFilter;
constructor(){
this.parameterFilter = new ParameterFilter();
this.parameterFilter.dateEnd = new Date().toISOString().substring(0,10).toString();
}}`
My Page
<datetime [(ngModel)]="parameterFilter.dateEnd" NgControl="dateEnd"></datetime>
I have the same problem, is there any solution?
closed / c7d8682df4837e578249df0c9f32f66c17ac28ba
@nkalinov what was the fix? This issue coming for me after upgrade to 1.1.4. Previously it was fine.
my template code <datetime [(ngModel)]="Purchasedate" [timepicker]="false" [datepicker]="datepickerOpts"></datetime>
can you write us your whole template please ? In my case, update to 1.1.4 has solved this issue
`<form (ngSubmit)="createorder(buyForm.value)" #buyForm="ngForm" >
</div>
`
FYI I am using old forms API
Hi @neelsbr
If you are using previous version of the @angular/forms you should use previous version of ng2-datetime or upgrade your project to @angular/forms 0.2.0.
I recomend to you upgrade your project to new version of forms, as I suppose @nkalinov doesn't have in plan support previous version of @angular/forms also as Google in next angular2 releases.
There is a reason the old forms are going to be deprecated. I strongly advise you to switch as soon as you can, only for the sake of your Angular2 lib's stability.
@rafalkasa's fix did it for me.
thanks @rafalkasa @wartab @nkalinov for your response. Let me update forms API
im having the same problem on the latest version for forms 0.2.0
any solution. running into the same issue e.rror "No provider for NgControl"
I'am currently not running this error with the last version of ng2-datetime and with angular@2.0.1
I'm still seeing this issue on angular@2.1.0
Me too, seeing this issue on angular@2.1.2
I managed to solve this issue. I was using the component in two locations and only one was throwing the error.
Turns out the one that was causing issues. I was not binding to [(ngModel)]. And only using the event. Try binding to [(ngModel)] and see if that helps.
I am also getting this error No provider for NgControl Have anyone got the Solution ?
Another solution is to use the @Optional()
decorator. More on that here: https://stackoverflow.com/a/48156981/6673479
Hi everybody ! I got this error "No provider for NgControl!" I'm using the new @angular/forms API with :
bootstrap(MyApp, [disableDeprecatedForms(), provideForms()]);
And i use datetime like in the demo :And my typescript file :
I don't understand why it's happening...
Thanks for your help Chocapic54
EDIT : Got same error when i copy paste demo files into my project