Service II error when display datetime


#1

I tried to solve this task :

2.Visit http://localhost:8000 to view the AngularJS app. Let's finish the view so that it displays the weather for each day.
Notice in the view, we're using ng-repeat to loop through each item in the days array. Inside this loop, display a day's four pieces of data.
Remember to use ng-src to display an image.

I added the code to print the date but it return an error. Screenshot for my code and the error is below

EDIT : this is my code
Index.html

<!doctype html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://s3.amazonaws.com/codecademy-content/projects/bootstrap.min.css" rel="stylesheet" />
    <link href="css/main.css" rel="stylesheet" />

    <!-- Include the AngularJS library -->
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js"></script>
  </head>
  <body ng-app="ForecastApp">

    <div class="main" ng-controller="MainController">
      <div class="container">
        <div class="row">
          <div class="col-sm-5 col-sm-offset-7">
            <h1>{{ fiveDay.city_name }}</h1>
            <h2>5-day forecast</h2>
            <div class="forecast" ng-repeat="day in fiveDay.days">
              <div class="day row">
                
                <!-- datetime -->
                <div class="weekday col-xs-4">
                 {{ day.datetime | date }}
                </div>


                <!-- icon -->
                <div class="weather col-xs-3">
                </div>

                <div class="col-xs-1"></div>


                <!-- high -->
                <div class="high col-xs-2">


                </div>


                <!-- low -->
                <div class="low col-xs-2">

                </div>
              </div>
            </div>
          </div>
        </div>
        </ul>
      </div>
    </div>

    <!-- Modules -->
    <script src="js/app.js"></script>

    <!-- Controllers -->
    <script src="js/controllers/MainController.js"></script>

    <!-- Services -->
        <script src="js/services/forecast.js"></script>

    <!-- Directives -->


  </body>
</html>

forecast.js

app.factory('forecast', ['$http', function($http){
  return $http.get('https://s3.amazonaws.com/codeacademy-content/courses/ltp4/forecast-api/forecast.json')
  .success(function(data) {
    return data;
  })
  .error(function(err) {
    return err;
  });
}]);

MainController.js

app.controller('MainController', ['$scope', 'forecast', function($scope, forecast) {
  forecast.success(function(data) {
    scope.fiveDay = data;
  });
}]);

App.js
var app = angular.module('ForecastApp', []);


#2

The session may have timed out, requiring a page refresh. Your code looks okay, what we can see of it.

While it's difficult to read the next couple of instructions, go ahead and complete them and run each time so your code is saved. It might iron the wrinkles out.

We'll assume for now that the service and controller are free of problems.


#3

yeah I already tried to refresh page. I wrote that code yesterday, and i try to run that code again today, but it's still doesn't work.
Can my browser affect the result? I'm using Firefox


#4

It's worth a try to switch to Chrome. Copy the URL and jump right into the same page. If that doesn't work then more looking...


#5

it's doesn't work in Chrome also


#6

Did you complete all the steps? What is displaying in the localhost browser?

I cannot get into the course right now because of overcrowding. If this is indeed a module issue, then there are going to be a lot of topics like this. We have to rule out your code. Please post everything you have right now. Controllers, Services, Views. Post raw code, not photos. Thanks.


#7

I'm having the same issue. I've tried using {{ day.datetime | date : 'EEEE' }} and {{ day.datetime | date : 'EEE' }} to display the weekday yet I am getting the same error.


#8

Yes, I completed all the steps, until i'm stuck in this error. The localhost browser doesn't display any error, just a background image and a title, based on template that given by this course

I edited the question and added html and js code that I use.


#9

There have been some reported issues in some of the courseware today. I suspect it is a problem with the server, making for a long day for the folks at CC. You may need to pause for a day or two and try some of the original track courses for review or practice.


#10

Yes, I think so.
And after almost a week and it hasn't fixed yet.


#11

I have the same problem, any solution?


#12

To be honest, it gave me errors until I typed in everything correctly. Also noticed that this error popped up when all my code was correct, except for the location at which I included the services script. I moved the location to the bottom, where it's supposed to be, and it worked right away. So maybe it thinks you have some code out of place? If not, try using some paragraph tags?


#13

Can you show your code?


#14

Done, I've reset the code and do it again. I think my mistake was I delete "" in the code with an error mark. This time I didn't remove it and works.


#15