MemberJunction / MJ

Main MemberJunction Repository
https://docs.memberjunction.org/
ISC License
4 stars 0 forks source link

Routing Edge Case #305

Closed AN-BC closed 3 months ago

AN-BC commented 3 months ago

Field Link Directive From this code within ng-field-link.ts - in some cases, an example being Template Content Types being the entity being linked to from a given Template Contents record, the ResourceResolverin the explorer-core doesn't get aresolve()call. In all other cases it works.

This will require more diagnostics to figure out the issue:

@JS-BC this is related to our discussion the other day


  @HostListener('click', ['$event'])
  onClick(event: Event) {
    event.preventDefault();
    if (!this._targetEntityInfo) 
      throw new Error('targetEntityInfo not set');

    // AT THE MOMENT - we only support foreign keys with a single value
    const keyVals = `${this._targetEntityInfo.FirstPrimaryKey.Name}|${this._targetRecordID}`
    const newURL: string[] = ['resource', 'record', keyVals];

    this.router.navigate(newURL, { queryParams: { Entity: this._targetEntity } }).then(params => {
      console.log('navigated to:', newURL.join('/'));
    }).catch(err => {
      const newURLString: string = newURL.join('/');
      LogError(`Error navigating to ${newURLString}: ${err}`);
    })
  }