085 Angular project configuration for Lookup resource Web Api - chempkovsky/CS82ANGULAR GitHub Wiki

Notes

  • Even if we haven't added a separate web application for the search resource PhbkEmployeeView, we still need to make some changes to the Angular project. Our modification will be the same as if we added a separate web application.

modify src\app\shared\interfaces\app-config.interface.ts

  • Add a line "phoneLpWebApi": string,
Click to show the code
export interface IAppConfig {
    "webApiUrl": string,
    "securityUrl": string,
    "permissionWebApi": string,
    "divisionLpWebApi": string,
    "employeeLpWebApi": string,
    "phoneLpWebApi": string,
}

modify the src\assets\app-config.json-file

  • Add the line "employeeLpWebApi": "http://localhost:5055/"
Click to show the code
{
  "webApiUrl": "http://localhost:5165/",
  "securityUrl": "https://localhost:7229/",
  "permissionWebApi": "https://localhost:7229/",
  "divisionLpWebApi": "http://localhost:5055/",
  "employeeLpWebApi": "http://localhost:5055/",
  "phoneLpWebApi": "http://localhost:5055/"
}

modify the src\app\shared\services\app-config.service.ts-file

  • Add the line employeeLpWebApi: '',
Click to show the code
...
@Injectable()
export class AppConfigService {
    public _appConfig: IAppConfig  = {
      webApiUrl: '',
      securityUrl: '',
      permissionWebApi: '',
      divisionLpWebApi: '',
      employeeLpWebApi: '',
      phoneLpWebApi: '',
    }; 
    constructor (private injector: Injector) { }
...

modify the src\app\shared\services\app-glbl-settings.service.ts-file

  • we need to modify in the getWebApiPrefix-method
Click to show the code
    public getWebApiPrefix(vwNm: string): string {
      let reslt: string = '';
      if (!(vwNm === null)) {
        //
        // here: defining url by ViewName
        //
        if (vwNm === 'LpdDivisionView' || vwNm === 'LprDivision01View' || vwNm === 'LprDivision02View') {
          reslt = this._settings.config.divisionLpWebApi;
        } else if (vwNm === 'LpdEmpLastNameView' || vwNm === 'LpdEmpFirstNameView' || vwNm === 'LpdEmpSecondNameView' || vwNm === 'LprEmployee01View' || vwNm === 'LprEmployee02View' ) {
            reslt = this._settings.config.phoneLpWebApi;
        } else if (vwNm === 'LpdPhoneView' || vwNm === 'LprPhone01View' || vwNm === 'LprPhone02View' || vwNm === 'LprPhone03View' || vwNm === 'LprPhone04View' ) {
            reslt = this._settings.config.employeeLpWebApi;
        } else {
          reslt = this._settings.config.webApiUrl;
        }
      }
      return reslt;
    } 

Test

  • run Webapi apps

  • run angular app

  • along mode

    • click list of Phones and make sure that filtering by Lookup resource is available only for re01 table
Click to show the picture

project structure

⚠️ **GitHub.com Fallback** ⚠️