         "$routeParams",
         "$q",
         "$location",
-        "$appTitle"
+        "$appTitle",
+        "tgLoader"
     ]
 
-    constructor: (@scope, @repo, @rs, @params, @q, @location, @appTitle) ->
+    constructor: (@scope, @repo, @rs, @params, @q, @location, @appTitle, tgLoader) ->
         @scope.sectionName = "Search"
 
         promise = @.loadInitialData()

        loadSearchData = debounce(200, (t) => @.loadSearchData(t))

        @scope.$watch "searchTerm", (term) ->
            return if not term
            loadSearchData(term)

    loadFilters: ->
        defered = @q.defer()

    loadSearchData: (term) ->
        promise = @rs.search.do(@scope.projectId, term).then (data) =>
            @scope.searchResults = data
            tgLoader.pageLoaded()
            return data

        return promise
