Angularjs 工厂 http 获取 'undefined is not a function'

Angularjs factory http get gives 'undefined is not a function'

这是我的代码。我收到一条错误消息:TypeError: undefined is not a function: 我觉得问题出在我对promise的理解不够,如果有人能开导我,我将不胜感激。

getProgramDetails:  function (program) {
    var _this = this;
    this.getDetails(program).then(function() {
        ....
    });
},
getDetails: function (program) {
    var _this = this;
    var deferred = $q.defer();

    // Error occurs at this line
    this.http.get({id: program.programID}).then(function(results) {
        if (results && results.programID) {
            _this.isNewProgram = false;
            _this.selectedProgram = {
                ...
            };
        } else {
            _this.isNewProgram = true;
            _this.selectedProgram = {
                ...
            };
        }
        deferred.resolve();
    });
    return deferred.promise;
},

http: $resource(
$window.detailsEndpoint',
{ id: '@id' },
{   //parameters default
    update: {
        method: 'PUT',
        params: {}
    },
    get: {
        method: 'GET',
        params: {
            id: '@id'
        }
    },
    post: {
        method: 'POST'
    }
})

我认为 $resource 没有像 $http 这样的 .then() 方法,而是尝试将回调作为第二个参数传递

this.http.get({id: program.programID}, function(results){});

或称其为$promise

this.http.get({id: program.programID}).$promise.then(function(results){});