Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
191 views
in Technique[技术] by (71.8m points)

html - Angular, datepicker not working on Safari

I have alittle problem with datepicker input. I have a piece of code like this, that gets the birth of date when sign-up;

        <div>
          <label for="date_of_birth"><b>Your Birthday</b></label>
          <input type="date" placeholder="Please enter your birthday" name="date_of_birth" required 
          [(ngModel)]="register.date_of_birth" style="margin-left: 20px;" date-picker> 
        </div>

It works fine with Chrome, when someone clicks on the input place, the date picker automatickly shows up. But at Safari, this is not working. I couldnt figure it out. What do I need to do in order this date picker to also work in Safari?

question from:https://stackoverflow.com/questions/65641297/angular-datepicker-not-working-on-safari

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This behaviour is expected when you only rely on the browser native functionality, this means each browsers will interpret ht type="date" separately, if you need consistent behaviour across browsers you need to use third party library, ie. Angular Material, Angular Bootstrap etc.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...