067 Angular project configuration for Lookup resource Web Api - chempkovsky/CS82ANGULAR GitHub Wiki
- Even if we haven't added a separate web application for the search resource
PhbkPhoneView
, 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.- we should repeat all the steps of the article 048 Angular project configuration for Lookup resource Web Api
- Add a line "phoneLpWebApi": string,
Click to show the code
export interface IAppConfig {
"webApiUrl": string,
"securityUrl": string,
"permissionWebApi": string,
"divisionLpWebApi": string,
"employeeLpWebApi": string,
}
- 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/"
}
- Add the line
employeeLpWebApi: '',
Click to show the code
...
@Injectable()
export class AppConfigService {
public _appConfig: IAppConfig = {
webApiUrl: '',
securityUrl: '',
permissionWebApi: '',
divisionLpWebApi: '',
employeeLpWebApi: '',
};
constructor (private injector: Injector) { }
...
- 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.employeeLpWebApi;
} else {
reslt = this._settings.config.webApiUrl;
}
}
return reslt;
}
-
run Webapi apps
-
run angular app
-
along mode
- click
list of Divisions
and make sure that filtering by Lookup resource is available only for re01 table
- click