本文整理匯總了TypeScript中ng-jhipster.EventManager.subscribe方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript EventManager.subscribe方法的具體用法?TypeScript EventManager.subscribe怎麽用?TypeScript EventManager.subscribe使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ng-jhipster.EventManager
的用法示例。
在下文中一共展示了EventManager.subscribe方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: registerAuthenticationSuccess
registerAuthenticationSuccess() {
this.eventManager.subscribe('authenticationSuccess', (message) => {
this.principal.identity().then((account) => {
this.account = account;
});
});
}
示例2: constructor
constructor(private alertService: AlertService, private eventManager: EventManager, private translateService: TranslateService) {
this.alerts = [];
this.cleanHttpErrorListener = eventManager.subscribe('baeldungApp.httpError', (response) => {
let i;
let httpResponse = response.content;
switch (httpResponse.status) {
// connection refused, server not reachable
case 0:
this.addErrorAlert('Server not reachable', 'error.server.not.reachable');
break;
case 400:
let arr = Array.from(httpResponse.headers._headers);
let headers = [];
for (i = 0; i < arr.length; i++) {
if (arr[i][0].endsWith('app-error') || arr[i][0].endsWith('app-params')) {
headers.push(arr[i][0]);
}
}
headers.sort();
let errorHeader = httpResponse.headers.get(headers[0]);
let entityKey = httpResponse.headers.get(headers[1]);
if (errorHeader) {
let entityName = translateService.instant('global.menu.entities.' + entityKey);
this.addErrorAlert(errorHeader, errorHeader, {entityName: entityName});
} else if (httpResponse.text() !== '' && httpResponse.json() && httpResponse.json().fieldErrors) {
let fieldErrors = httpResponse.json().fieldErrors;
for (i = 0; i < fieldErrors.length; i++) {
let fieldError = fieldErrors[i];
// convert 'something[14].other[4].id' to 'something[].other[].id' so translations can be written to it
let convertedField = fieldError.field.replace(/\[\d*\]/g, '[]');
let fieldName = translateService.instant('baeldungApp.' +
fieldError.objectName + '.' + convertedField);
this.addErrorAlert(
'Field ' + fieldName + ' cannot be empty', 'error.' + fieldError.message, {fieldName: fieldName});
}
} else if (httpResponse.text() !== '' && httpResponse.json() && httpResponse.json().message) {
this.addErrorAlert(httpResponse.json().message, httpResponse.json().message, httpResponse.json());
} else {
this.addErrorAlert(httpResponse.text());
}
break;
case 404:
this.addErrorAlert('Not found', 'error.url.not.found');
break;
default:
if (httpResponse.text() !== '' && httpResponse.json() && httpResponse.json().message) {
this.addErrorAlert(httpResponse.json().message);
} else {
this.addErrorAlert(JSON.stringify(httpResponse)); // Fixme find a way to parse httpResponse
}
}
});
}
示例3: registerChangeInComments
registerChangeInComments() {
this.eventSubscriber = this.eventManager.subscribe('commentListModification', (response) => this.reset());
}
示例4: registerChangeInProductReviews
registerChangeInProductReviews() {
this.eventSubscriber = this.eventManager.subscribe('productReviewListModification', (response) => this.load(this.productReview.id));
}
示例5: registerChangeInContentDescriptions
registerChangeInContentDescriptions() {
this.eventSubscriber = this.eventManager.subscribe('contentDescriptionListModification', (response) => this.load(this.contentDescription.id));
}
示例6: registerChangeInUsers
registerChangeInUsers() {
this.eventManager.subscribe('userListModification', (response) => this.loadAll());
}
示例7: registerChangeInFileHistories
registerChangeInFileHistories() {
this.eventSubscriber = this.eventManager.subscribe('fileHistoryListModification', (response) => this.loadAll());
}
示例8: registerChangeInWishes
registerChangeInWishes() {
this.eventSubscriber = this.eventManager.subscribe('wishListModification', response => this.load(this.wish.id));
}
示例9: registerChangeInTransactions
registerChangeInTransactions() {
this.eventSubscriber = this.eventManager.subscribe('transactionListModification', (response) => this.loadAll());
}
示例10: registerChangeInZones
registerChangeInZones() {
this.eventSubscriber = this.eventManager.subscribe('zoneListModification', (response) => this.load(this.zone.id));
}