Outbox 2, Redux


#1

After doing my due diligence, I’m wondering if the issue with the mini-browser can be/will be/has been corrected?

I did have a view of the email list and then after I did steps 4 & 5, that view disappeared and now I cannot see anything.

app.js

var app = angular.module('OutboxApp', ['ngRoute']);

app.config(function ($routeProvider) {
  $routeProvider
  .when('/outbox', {
    controller: 'HomeController',
    templateUrl: 'views/home.html'
  })
  .when('/outbox/:id',{
    controller:'EmailController',
    templateUrl:'views/email.html'
  })
  .otherwise({
  	redirectTo: '/'
  });
});

email.html

<a class="back" href="#/outbox">Back</a>

<div class="email-view">
  <h2 class="subject">{{email.subject}}</h2>
  <span class="from">{{email.from}}</span><span class="date">{{email.datetime | date}}</span>
  <p class="message">{{email.message}}</p>
</div>

EmailController.js

app.controller('EmailController', ['$scope', 'emails', '$routeParams', function($scope, emails, $routeParams) {
  emails.success(function(data) {
    $scope.email = data[$routeParams.id];
  });
}]);

index.html

<!doctype html>
<html>
  <head>
    <link href="https://s3.amazonaws.com/codecademy-content/projects/bootstrap.min.css" rel="stylesheet" />
    <link href="css/main.css" rel="stylesheet" />
    <script src="js/vendor/angular.min.js"></script>
    <script src="https://code.angularjs.org/1.2.28/angular-route.min.js"></script>    
  </head>
  <body ng-app="OutboxApp">
    <div class="header">
      <div class="container">
        <img src="img/logo.svg" width="140" height="150">
      </div>
    </div>

    <div class="main">
      <div class="container">
        <div ng-view></div>
      </div>
    </div>

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

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

    <!-- Services -->
    <script src="js/services/emails.js"></script>
  </body>
</html>

home.html

<div class="email" ng-repeat="email in emails">
  <a href="#/outbox/{{$index}}">
    <span class="from">{{ email.from }}</span><span class="subject">{{ email.subject }}</span><span class="date">{{ email.datetime | date }}</span>
  </a>
</div>

HomeController.js

app.controller('HomeController', ['$scope', 'emails', function($scope, emails) {
  emails.success(function(data) {
    $scope.emails = data;
  });  
}]);