1
下面的代碼行生成以下警告:角時刻棄用警告
<span>{{prac.dateShown | amAdd: i : 'd' | amDateFormat:'dddd D MMM'}}</span>
棄用警告:時刻施工回落到JS日期。
以下兩行代碼都沒有。有誰知道發生了什麼事?
<span>{{prac.dateShown | amAdd: i : 'd'}}</span>
<span>{{prac.dateShown | amDateFormat:'dddd D MMM'}}</span>
i
是從陣列的數:[0,1,2,3,4,5,6,]
prac.dayShown
是在我的控制器一時刻的變量。
添加更多的代碼
<div ng-repeat="prac in practices">
<table>
<thead>
<tr>
<th ng-repeat="i in [0,1,2,3,4,5,6]">
<span>{{prac.dateShown | amAdd: i : 'd' | amDateFormat:'dddd D MMM'}}</span>
</th>
</tr>
</thead>
<tbody>
[...]
</tbody>
</table>
</div>
只有在沒有指定輸入格式或作爲標準ISO格式之一的情況下解析字符串時,纔會顯示該錯誤。是否有可能'prac.dateShown'實際上是一個*字符串*而不是一個時刻對象? –
是100%確定。這是聲明:'prac.dateShown = moment()' – Mika
添加一些代碼以防萬一它有幫助...真的很茫然...... – Mika