このエラーが発生しましたThe ng-model for md-datepicker must be a Date instance. Currently the model is a: string
。私はまた、私はいくつかのmdLocale.formatDateとはparsedataを試してみましたモデルに...ビューでmd- datePicker - 日付インスタンスエラー常に
<md-datepicker ng-model="Model.currentContact.getSetIncorporated" ng-model-options="{ getterSetter: true }" md-placeholder="Enter date"></md-datepicker>
Contact.prototype.getSetIncorporated = function(date) {
if (arguments.length) {
this.company.information.incorporatedObject = date;
this.company.information.incorporated = moment.utc(date).format('X');
}
if (!this.company.information.incorporatedObject) {
if (this.company.information.incorporated !== '') {
this.company.information.incorporatedObject = moment.utc(this.company.information.incorporated, 'X').toDate();
} else {
this.company.information.incorporatedObject = null;
}}
return this.company.information.incorporatedObject;
}
を瞬間を使用しています。現在のバージョンでは、私は、新しいDate()とDateオブジェクトにその文字列を変換する場合
$mdDateLocale.formatDate = function(date) {
return moment(date).format('YYYY/MM/DD');
};
$mdDateLocale.parseDate = function(dateString) {
var m = moment(dateString, 'YYYY/MM/DD', true);
return m.isValid() ? m.toDate() : new Date(NaN);
};
は、サーバがこの文字列
2016-09-10T22:00:00.000Z
を送信しているですが、私はmdDatePickerに示す右側の結果を得るが、私はまた Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
を取得しています私のページを制圧する。
を、私はそれが文字列である知っている...私もその文字列を変換してみてください新しい日付(stringDate)で、無限のダイジェストループエラーが発生しました。 – Alexa
'未知のエラー:[$ rootScope:infdig] 10 $ digest()反復に達しました。中止! ' – Alexa
@Alexa - あなたの質問を主な問題として追加することができます。 –