angular - Error directives declaration if minification angular2 bundle -
if minified bundle, error: unhandled promise rejection: template parse errors: can't bind 'seterror' since isn't known property of 'http_result'. ("
<http_result [error ->][seterror]="error"></http_result> <div class="popup-body-wrapper">
http_popup_errors.directive.ts
import { component, directive, elementref, hostlistener, input,output, eventemitter, renderer, viewchild, afterviewinit } '@angular/core';
import { determinationerrorservice } './determination_errors.service'; //import * $ 'jquery';
@component({ selector: 'http_result', template: `<div class="http-result-wrapper"> <p class="success-notice" *ngif="notice.state == 'notice'">{{ notice.message }}</p> <p class="error-notice" *ngif="notice.state == 'error'">{{ notice.message }}</p> </div>`, }) export class httppopuperrors { private determinationerror; constructor() { this.determinationerror = new determinationerrorservice(); } private notice = { state: '', message: '' }; @input() set setsuccess (message: string) { if(message) { this.notice.state = 'notice'; this.notice.message = message; } else { this.notice.state = ''; this.notice.message = ''; } } @input() set seterror (error: any) { if(error) { this.notice.state = 'error'; this.notice.message = this.determinationerror.geterrormessage(error); } else { this.notice.state = ''; this.notice.message = ''; } } }
parth of app.module.ts
... import { httppopuperrors} './admin/determination_errors/http_popup_errors.directive'; ... @ngmodule({ imports: [ ... ], declarations: [ ... httppopuperrors ], providers: [ ... ], schemas: [ custom_elements_schema ], bootstrap: [ maincomponent ] })
i added directive in component called recovery.component.ts
import { httppopuperrors} '../determination_errors/http_popup_errors.directive'; @component({ selector: 'recovery', templateurl: 'app/admin/recovery/recovery.component.html', providers: [ authservice ], directives: [httppopuperrors] }) export class recoverycomponent { ... }
help, please, why have error , how fixed it?
Comments
Post a Comment