angular

Ngrx effect parallel http call

左心房为你撑大大i 提交于 2021-02-17 02:08:09
问题 I have an effect that should call two different APIs (API1 and API2). Here's the effect $LoadKpiMission = createEffect(() => this.actions$.pipe( ofType<any>(EKpiActions.GetMissionsByStation), mergeMap(action => this.apiCallsService.getKpi(action.payload, '2016-04-18').pipe( map(trips => ({ type: EKpiActions.GetMissionsSuccess, payload: trips })), catchError(() => EMPTY) ) ) ) ); Here's the structure of the service getKpi(station: number, date: string) { let Kpi = `http://192.168.208.25:8998

Ngrx effect parallel http call

会有一股神秘感。 提交于 2021-02-17 02:07:34
问题 I have an effect that should call two different APIs (API1 and API2). Here's the effect $LoadKpiMission = createEffect(() => this.actions$.pipe( ofType<any>(EKpiActions.GetMissionsByStation), mergeMap(action => this.apiCallsService.getKpi(action.payload, '2016-04-18').pipe( map(trips => ({ type: EKpiActions.GetMissionsSuccess, payload: trips })), catchError(() => EMPTY) ) ) ) ); Here's the structure of the service getKpi(station: number, date: string) { let Kpi = `http://192.168.208.25:8998

Ngrx effect parallel http call

ぐ巨炮叔叔 提交于 2021-02-17 02:07:22
问题 I have an effect that should call two different APIs (API1 and API2). Here's the effect $LoadKpiMission = createEffect(() => this.actions$.pipe( ofType<any>(EKpiActions.GetMissionsByStation), mergeMap(action => this.apiCallsService.getKpi(action.payload, '2016-04-18').pipe( map(trips => ({ type: EKpiActions.GetMissionsSuccess, payload: trips })), catchError(() => EMPTY) ) ) ) ); Here's the structure of the service getKpi(station: number, date: string) { let Kpi = `http://192.168.208.25:8998

Object literal may only specify known properties, and 'buttons' does not exist in type 'Settings

僤鯓⒐⒋嵵緔 提交于 2021-02-16 20:10:18
问题 I am using Angular 8 and following example from here but and the exception is Please help me solve this. 回答1: Just make sure the dtOptions is declared as any . You can find this comment on: https://l-lin.github.io/angular-datatables/#/extensions/buttons // Must be declared as "any", not as "DataTables.Settings" dtOptions: any = {}; 回答2: If the Type Settings has been defined by you or your team, you must add the buttons property as: buttons: any[]; Or buttons?: any[]; To keep retro

Call a Promise from an Angular HttpInterceptor

旧时模样 提交于 2021-02-16 20:07:38
问题 I've got an angular HttpInterceptor and I need to call an encryption method that's defined like so: private async encrypt(obj: any): Promise<string> { I'm not sure how to handle this in the HttpInterceptor though: intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { const modified = req.clone({ body: this.encrypt(req.body) }); return next.handle(modified).pipe( I'm not sure how to tie the two of those together so that I can call the encrypt method properly from

Call a Promise from an Angular HttpInterceptor

£可爱£侵袭症+ 提交于 2021-02-16 20:06:32
问题 I've got an angular HttpInterceptor and I need to call an encryption method that's defined like so: private async encrypt(obj: any): Promise<string> { I'm not sure how to handle this in the HttpInterceptor though: intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { const modified = req.clone({ body: this.encrypt(req.body) }); return next.handle(modified).pipe( I'm not sure how to tie the two of those together so that I can call the encrypt method properly from

Call a Promise from an Angular HttpInterceptor

此生再无相见时 提交于 2021-02-16 20:06:20
问题 I've got an angular HttpInterceptor and I need to call an encryption method that's defined like so: private async encrypt(obj: any): Promise<string> { I'm not sure how to handle this in the HttpInterceptor though: intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { const modified = req.clone({ body: this.encrypt(req.body) }); return next.handle(modified).pipe( I'm not sure how to tie the two of those together so that I can call the encrypt method properly from

RegEx in Angular 2 Form Validators producing different results when argument is a String vs a RegExp class

☆樱花仙子☆ 提交于 2021-02-16 19:04:11
问题 I'm attempting to validate a basic form element using Angular 2 Form Validators, and the RegEx I'm placing in to Validators.pattern() to match a valid URL is matching patterns that theoretically aren't valid when the argument is a String data type. // example.component.ts this.exampleForm = fb.group({ // The patterns below will match most URL structures, and are exactly the same const reg = '^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$'; const patt = new RegExp(/^(https?:\/\

RegEx in Angular 2 Form Validators producing different results when argument is a String vs a RegExp class

百般思念 提交于 2021-02-16 19:03:54
问题 I'm attempting to validate a basic form element using Angular 2 Form Validators, and the RegEx I'm placing in to Validators.pattern() to match a valid URL is matching patterns that theoretically aren't valid when the argument is a String data type. // example.component.ts this.exampleForm = fb.group({ // The patterns below will match most URL structures, and are exactly the same const reg = '^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$'; const patt = new RegExp(/^(https?:\/\

RegEx in Angular 2 Form Validators producing different results when argument is a String vs a RegExp class

萝らか妹 提交于 2021-02-16 19:03:29
问题 I'm attempting to validate a basic form element using Angular 2 Form Validators, and the RegEx I'm placing in to Validators.pattern() to match a valid URL is matching patterns that theoretically aren't valid when the argument is a String data type. // example.component.ts this.exampleForm = fb.group({ // The patterns below will match most URL structures, and are exactly the same const reg = '^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$'; const patt = new RegExp(/^(https?:\/\