title: AngularJS syntax error / expected expression?
body: <p>I'm trying to add a post method to my controller, but I keep getting a syntactical error that I can't trace. My goal is for a single controller to fetch() on init, and then have buttons within the controller that can call additem(itemid) on click.</p>
  
  <p>Here's my app.js:</p>
  
  <pre><code>(function(angular) {
   'use strict';
    angular.module('myApp', [])
      .controller('ItemsController', ['$scope', '$http', '$log',
        function($scope, $http) {
          $scope.method = 'GET';
          $scope.url = '/path/to/api';
          $scope.fetch = function() {
          $scope.code = null;
          $scope.response = null;
        var response = $http({method: $scope.method, url: $scope.url}).
          then(function(response) {
            $scope.status = response.status;
            $scope.data = response.data;
            $scope.thedata = JSON.stringify(response.data);
            $scope.count = $scope.data.length
            console.log($scope.thedata);
            console.log($scope.data[0]);
          }, function(response) {
            $scope.data = response.data || "Request Failed";
            $scope.status = response.status;
          })
      };
      $scope.additem = function(itemid) {
        var itemdata = new Object();
        itemdata.itemid = itemid;
        $http.post($scope.url, itemdata).success(function(data){
            //Callback function here.
            //"data" is the response from the server.
            if (data.status === "success") {
              console.log("Added!")
            }
        });
      }
    }]),
  ]);   // SyntaxError: expected expression, got ']'
  })(window.angular);
  </code></pre>
  
  <p>On the line just before (window.angular); I get this error in the Firefox console:</p>
  
  <pre><code>SyntaxError: expected expression, got ']'
  </code></pre>
  
  <p>I'm pretty sure my indentation is a little messed up towards the end, so it's tough to discern what is causing it...</p>