         # Hide the reslist on blur
         input.bind 'blur', (e) ->
           scope.reslist = null
-          scope.()
+          scope.$digest()
           return
         return
 
   }
-).controller('MainCtrl', (, , Weather, UserService) ->
-  .date = {}
+).controller('MainCtrl', ($scope, $timeout, Weather, UserService) ->
+  $scope.date = {}
 
   updateTime = ->
-    .date.tz = new Date((new Date).toLocaleString('en-US', timeZone: .user.timezone))
-     updateTime, 1000
+    $scope.date.tz = new Date((new Date).toLocaleString('en-US', timeZone: $scope.user.timezone))
+    $timeout updateTime, 1000
     return
 
-  .weather = {}
-  .user = UserService.user
-  Weather.getWeatherForecast(.user.location).then (data) ->
-    .weather.forecast = data
+  $scope.weather = {}
+  $scope.user = UserService.user
+  Weather.getWeatherForecast($scope.user.location).then (data) ->
+    $scope.weather.forecast = data
     return
   updateTime()
   return
-).controller 'SettingsCtrl', (, , Weather, UserService) ->
-  .user = UserService.user
+).controller 'SettingsCtrl', ($scope, $location, Weather, UserService) ->
+  $scope.user = UserService.user
 
-  .save = ->
+  $scope.save = ->
     UserService.save()
-    .path '/'
+    $location.path '/'
     return
 
-  .fetchCities = Weather.getCityDetails
+  $scope.fetchCities = Weather.getCityDetails
   return
 
 # ---
 # generated by js2coffee 2.2.0
-

      @apiKey = key
    return

  @ = (, ) ->
    self = this
    {
      getWeatherForecast: (city) ->
        d = .defer()
        (
          method: 'GET'
          url: self.getUrl('forecast', city)
          cache: true).success((data) ->
          console.log data
          d.resolve data.forecast.simpleforecast
          return
        ).error (err) ->

          val = ele.val()
          if val.length < minKeyCount
            if timer
              $timeout.cancel timer
            scope.reslist = null
            return
          else
            if timer
              $timeout.cancel timer
            timer = $timeout((->
              scope.autoFill()(val).then (data) ->
                if data and data.length > 0
                  scope.reslist = data
