kendoValidator acces to Angular2 component propert

2019-06-08 17:04发布

问题:

I am using Kendo Upload in my Angular 2 application.I have inject servcie for error message and file permissible size,but when KendoValidator called, this.service is already undefined.

 export class MyUpload implements AfterViewInit {

  private message:string="message error":


    constructor() {
    }



    ngAfterViewInit(): any {
         $("#files").kendoUpload({
            multiple: false

        });
        $("#uploadForm").kendoValidator({
            messages: {
                fileSize: message
            },
            rules: {
                fileSize: function (e: any) {

                   return ....;
                }
            },
            validateOnBlur: false
        });
    }

How can I use this.service for getting size and message?