1 import { Component, OnInit, Input, Inject, ViewChild, TemplateRef, ElementRef, Output, EventEmitter } from '@angular/core';
2 import { BsModalService } from 'ngx-bootstrap/modal';
3 import { BsModalRef } from 'ngx-bootstrap/modal/modal-options.class';
4
5 import { FileUploader, FileUploaderOptions } from 'ng2-file-upload';
6 import ConstantsList from '../../common/constants/config';
7 import { BackCode } from '../../module/common/common';
8 import { UserNews } from '../../module/business/login';
9
10 @Component({
11 selector: 'app-uploadfile',
12 templateUrl: './uploadfile.component.html',
13 styleUrls: ['./uploadfile.component.css']
14 })
15 export class UploadfileComponent implements OnInit {
16
17 @ViewChild('templateUploadFile') public template: TemplateRef<any>;
18 modalRef: BsModalRef;
19 ModalConfig = { animated: false, keyboard: false, backdrop: true, ignoreBackdropClick: true, };
20 @Input() public userNews: UserNews;
21 @Output() weburl: EventEmitter<string> = new EventEmitter<string>();
22 isError:boolean = false;
23 stringError:string;
24
25 constructor(private modalService: BsModalService, @Inject('public_service') private publicservice: any) { }
26
27 ngOnInit() { }
28
29 openModal(template: TemplateRef<any>) {
30 this.modalRef = this.modalService.show(template, Object.assign({}, this.ModalConfig, { class: 'modal-sm' }));
31 }
32
33 closeModal() {
34 this.modalRef.hide();
35 this.modalRef = null;
36 this.stringError = '';
37 this.isError = false;
38 }
39
40 public show() {
41 this.openModal(this.template);
42 this.stringError = '';
43 this.isError = false;
44 }
45
46 onSelectChange(event: EventTarget) );
62 }
63 else
67 }
68
69 checkIsImage(filename: string): boolean else {
74 return false;
75 }
76 }
77
78 }