shlomiassaf / ngx-modialog

Modal / Dialog for Angular
http://shlomiassaf.github.io/ngx-modialog
MIT License
686 stars 242 forks source link

'OrderItemPreviewComponent' has no properties in common with type 'CloseGuard'. #371

Closed magesticX closed 7 years ago

magesticX commented 7 years ago

I'm getting that error on compile time here's my code

import {CloseGuard, ModalComponent, DialogRef}          from "angular2-modal";
import {Component}                                      from "@angular/core";
import {BSModalContext}                                 from 'angular2-modal/plugins/bootstrap';
import {AuthService}                                    from '../../auth/services/auth.service';

@Component({
    templateUrl: './order-item-preview.component.html'
})
export class OrderItemPreviewComponent implements CloseGuard, ModalComponent<BSModalContext> {

    public context: BSModalContext;
    public printToken: string;
    private item: any;

    constructor(
        public dialog: DialogRef<BSModalContext>,
        private AuthService: AuthService
    ) {
        this.context = dialog.context;
        this.printToken = this.AuthService.getPrintToken();
        dialog.setCloseGuard(this);
    }

    ngOnInit() {
        if (this.context.hasOwnProperty('item')) {
            this.item = this.context['item'];
        }
    }

    close() {
        this.dialog.destroy();
    }
}

Anyone knows what this error is about?

Thanks and more power.

magesticX commented 7 years ago

Got it working. Updated typescript version to 2.3.4 fixes this issue.