私のangularJsファクトリから、この素晴らしいjson配列をphp server-mysqlバックエンドから正しく受け取ることができます。これは、開始日といくつかのランデブーです:.then()関数内でangular.forEachを実行しようとするとエラーが発生する
[{"id":"1","title":"Loi Travail","infos":null,
"adresse":"12 avenue des lis 78013 paris",
"criticite":"4","fichiers":null,
"start":"2017-06-11T22:37:59.012Z"},
{"id":"17","title":"jjtyjyjt","infos":"jytjjyjyj",
"adresse":"tjtyjjyj","criticite":"7","fichiers":"",
"start":"2017-06-11T22:37:59.012Z"}]
問題は、それが文字列であるので、角度、材料のDateTimePickerは、開始日を認識しないので、私は追加するには、ループを行う必要があるということですnew Date()
、それぞれの「開始」要素を変換します。
だから、私はこの短いコードやった:
rdvFactory.get_rdvs().then(function(data){
console.log(data.data);
angular.forEach(data.data),function(value,index){
console.log(value.start);
}
}).finally(function(){})
を私にconsole.logは何も示していないし、代わりに私はこの奇妙0エラー持っている:
TypeError: b is undefined Trace de la pile : [email protected]https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:7:481 @http://localhost/rdvjuristes/app.js:61:2 h/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:134:467 [email protected]https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:145:417 [email protected]https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:149:111 [email protected]https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:102:87 wg/https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:107:489 Possibly unhandled rejection: {}
はあなたを行いますがそれが$ qの事に関係していると思いますか?多分、日付を変換する別の方法がありますか?
アイデアがあれば、ありがとうございます。良い一日を。
私はこれを入力した場合だけについては、その後、カレンダーがうまく-vous RENDEZを表示する()新しい日付(を見てください):
$scope.events = [{"id":"1","title":"Loi Travail","infos":null,
"adresse":"12 avenue des lis 78013 paris",
"criticite":"4","fichiers":null,
"start":new Date("2017-06-11T22:37:59.012Z")}]
'angular.forEach(data.data)、機能(値、インデックス)' ' –
はあなたにそれが多くのことを感謝' angular.forEach(data.data、関数(値、インデックス)すべきか今働いて、あなたはとても良いです!そして、拒絶された "奇妙な"言葉が私を笑いにしました。こんにちは – user7370387