UNPKG

@angular-jz/jz

Version:

jim jz

62 lines 2.72 kB
"use strict"; var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; Object.defineProperty(exports, "__esModule", { value: true }); var router_1 = require("@angular/router"); var ng_bootstrap_1 = require("@ng-bootstrap/ng-bootstrap"); var angular2_toaster_1 = require("angular2-toaster"); var CurdViewPageComponentOptions = /** @class */ (function () { function CurdViewPageComponentOptions() { } return CurdViewPageComponentOptions; }()); exports.CurdViewPageComponentOptions = CurdViewPageComponentOptions; var CrudViewPageComponent = /** @class */ (function () { function CrudViewPageComponent(injector, options) { this.injector = injector; this.options = options; this.item = {}; this.criteria = {}; this.dics = {}; this.crudService = options.crudService; this.modalService = injector.get(ng_bootstrap_1.NgbModal); this.toasterService = injector.get(angular2_toaster_1.ToasterService); this.route = injector.get(router_1.ActivatedRoute); //this.toasterService = injector.get(ToasterService); } CrudViewPageComponent.prototype.ngOnInit = function () { var _this = this; this.routeSub = this.route.queryParams.subscribe(function (params) { _this.criteria = __assign({}, _this.criteria, params); _this.hookBeforePageLoad(); _this.crudService.getItem(_this.criteria).then(function (data) { _this.item = data.item; for (var objKey in data) { if (objKey != 'item' && objKey != 'dics') { _this.dics[objKey] = data[objKey]; } else if (objKey == 'dics') { data[objKey].forEach(function (dic) { _this.dics[dic.dicKey] = dic.children; }); } } _this.hookAfterPageLoadDataReceived(data); }); }); }; CrudViewPageComponent.prototype.hookBeforePageLoad = function () { }; CrudViewPageComponent.prototype.hookAfterPageLoadDataReceived = function (data) { }; CrudViewPageComponent.prototype.ngOnDestory = function () { this.routeSub.unsubscribe(); }; return CrudViewPageComponent; }()); exports.CrudViewPageComponent = CrudViewPageComponent; //# sourceMappingURL=crud-view.page.component.js.map