next: function (response) { var headers = {}; response.headers.forEach(function (value, name) { headers[name] = value; }); var res = Object.assign({}, response, { headers: headers }); if (lang_1.isPresent(currentNode)) { currentNode.res = res; } obs.next(response); },
NgPreloadCacheHttp.prototype.preload = function (factory) { var _this = this; var obs = new core_1.EventEmitter(true); var currentNode = null; if (lang_1.isPresent(this._activeNode)) { currentNode = { children: [], res: null }; this._activeNode.children.push(currentNode); } // We need this to ensure all ajax calls are done before rendering the app this._async += 1; var request = factory(); request.subscribe({ next: function (response) { var headers = {}; response.headers.forEach(function (value, name) { headers[name] = value; }); var res = Object.assign({}, response, { headers: headers }); if (lang_1.isPresent(currentNode)) { currentNode.res = res; } obs.next(response); }, error: function (e) { _this._async -= 1; obs.error(e); }, complete: function () { _this._activeNode = currentNode; _this._async -= 1; _this._activeNode = null; obs.complete(); } }); return request; };
complete: function () { _this._activeNode = currentNode; _this._async -= 1; _this._activeNode = null; obs.complete(); }
error: function (e) { _this._async -= 1; obs.error(e); },
select(selectedCourse) { this.selectedCourse = selectedCourse; this.changed.emit(selectedCourse); }