Project

General

Profile

« Previous | Next » 

Revision 51441

Add check for adding emptymanager or subject

View differences:

community-edit-form.component.ts
63 63
            community["description"] = this.community.description;
64 64
            community["logoUrl"] = this.community.logoUrl;
65 65

  
66
            // let length = Array.isArray(this.community.managers) ? this.community.managers.length :1;
67
            //
68
            // console.log(this.community.managers);
69
            //
70
            // community['managers'] = new Array<string>();
71
            //
72
            // for (let i=0; i<length; i++) {
73
            //
74
            //     community['managers'][i] = this.community.managers[i];
75
            //     console.log(this.community.managers[i]);
76
            //  }
77
            community["managers"] = this.community.managers;
78
            community["subjects"] = this.community.subjects;
66
            let man_length = Array.isArray(this.community.managers) ? this.community.managers.length :1;
79 67

  
68
            console.log(this.community.managers);
69

  
70
            community['managers'] = new Array<string>();
71

  
72
            for (let i = 0; i < man_length; i++) {
73
                if( this.community.managers[i] != '') {
74
                    community['managers'][i] = this.community.managers[i];
75
                    console.log(this.community.managers[i]);
76
                } else {
77
                    console.log(this.community.managers[i]);
78
                    this.community.managers.splice(i,1);
79
                }
80
             }
81

  
82
             let sub_length = Array.isArray(this.community.subjects) ? this.community.subjects.length :1;
83

  
84
             console.log(this.community.subjects);
85

  
86
             community['subjects'] = new Array<string>();
87

  
88
             for (let i = 0; i < sub_length; i++) {
89
                 if( this.community.subjects[i] != '') {
90
                     community['subjects'][i] = this.community.subjects[i];
91
                     console.log(this.community.subjects[i]);
92
                 } else {
93
                     console.log(this.community.subjects[i]);
94
                     this.community.subjects.splice(i,1);
95
                 }
96
              }
97

  
80 98
            console.log(this.properties.communityAPI);
81 99
            this._communityService.updateCommunity(this.properties.communityAPI+this.communityId, community).subscribe();
82 100
            this._router.navigate(['/community-edit-form'], { queryParams: { "communityId": this.communityId} });

Also available in: Unified diff