Project

General

Profile

« Previous | Next » 

Revision 60312

[Library | Trunk]: Fix portal form undefined error

View differences:

portals.component.ts
181 181
      piwik: this._fb.control(portal.piwik),
182 182
      type: this._fb.control(portal.type, Validators.required),
183 183
    });
184
    this.portalForm.controls['type'].disable();
184
    this.portalForm.get('type').disable();
185 185
    this.modalErrorMessage = '';
186 186
    this.portalModalOpen('Edit Portal', 'Save');
187 187
  }
188 188
  
189 189
  public newPortal() {
190
    this.portalForm.controls['type'].enable();
190
    if(this.portalForm) {
191
      this.portalForm.get('type').enable();
192
    }
191 193
    this.portalForm = this._fb.group({
192 194
      _id: this._fb.control(''),
193 195
      name: this._fb.control('', Validators.required),
......
228 230
    } else {
229 231
      this.modalErrorMessage = '';
230 232
      if (this.portalForm.value._id) {
231
        this.portalForm.controls['type'].enable();
233
        this.portalForm.get('type').enable();
232 234
        this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalForm.value,
233 235
          this.properties.adminToolsAPIURL).subscribe(
234 236
          portal => {
......
254 256
        queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}
255 257
      });
256 258
    } else {
257
      this.portalForm.controls['type'].enable();
259
      this.portalForm.get('type').enable();
258 260
      this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalForm.value,
259 261
        this.properties.adminToolsAPIURL).subscribe(
260 262
        portal => {

Also available in: Unified diff