Azure B2C login with cypress

I’ve an angular project and I tried to test the azure b2c login with cypress. I’m a newBie and I tried in this way: describe(‘login’, () => { beforeEach(() => cy.clearCookies()); it(‘get the access token test’, () => { cy.visit(‘/’); cy.get(‘button’).click(); cy.get(‘input#email’).type(‘[email protected]’); cy.get(‘input#password’).type(‘mypassword’); cy.get(‘button#next’).click(); }); }); It works but when I completed the login I […]

By Andy88
Published
Categorized as angular, azure, azure-ad-b2c, cypress, oauth-2.0 Tagged , , , ,

Angular Typescript – Async await on internal subscription

I have a function like this; openModalWhenRemoveItem() { callRemoveService(); openMyModal(); } callRemoveService() function has a subscribe and it’s async function, the openMyModal() function must be invoked after callRemoteService() callRemoveService() { combineLatest(myAccountSelector$, myCompanySelector$).pipe( switchMap(res) => this.myService.remove(res[0].id, res[1].id)) .subscribe((res)=> console.log(res)) } I need to create a function that has to wait the internal subscription in callRemoveService() before […]

By Andy88
Published
Categorized as angular, javascript, typescript Tagged , ,

Angular NGRX RXJS – Subscription to other observables inside effects don’t work

I have an issue, I have a service to manage SSE and I write this service: getAllNotify(url: string): Observable<EventDTO> { return new Observable(observer => { const eventSource = this.getEventSource(url); eventSource.onopen = function () { console.log(‘connection for all data is established’); }; eventSource.onmessage = event => { this.zone.run(() => { if (eventSource.readyState !== 0) { observer.next(JSON.parse(event.data)); […]

By Andy88
Published
Categorized as angular, ngrx, rxjs, typescript Tagged , , ,

Angular – How to set a dynamic environment variable?

I have an environment.ts like this: export const environment = { production: false, // SERVER_API_URL: ‘http://localhost:8080/’, baseImgUrl: “, }; To initialize the baseImgUrl I need to call a service, and in the ngOnInit in the app.component.ts I do it: this.getImageUrl().subscribe(res => {environment.baseImgUrl = res.value}); But this is an async function and in other components I […]

By Andy88
Published
Categorized as angular, typescript Tagged ,

Ngrx Effects – how to dispatch two actions?

Is there a way to dispatch multiple actions in a createEffect function? loadMovies$ = createEffect(() => this.actions$.pipe( ofType(‘[Movies Page] Load Movies’), mergeMap(() => this.moviesService.getAll().pipe( map(movies => /* return an array of actions */ [ { type: ‘[Movies API] Movies Loaded Success’, payload: movies }, { type: ‘[Movies API] Movies Loaded Success 2’, payload: movies }, […]

By Andy88
Published
Categorized as angular, ngrx Tagged ,

Angular – How to access to child component from grandparent component?

I have a componentA that has an ng-content. After this I have a componentB inside the component A. The componentB has a componentC in his template. componentA template: <ng-content></ng-content> componentB template: <componentC></componentC> componentC template: <div> <span>test</span> <div> In my html I have this final solution: <componentA> <componentB></componentB> </componentA> I would use a viewChild inside the […]

By Andy88
Published
Categorized as angular, typescript Tagged ,

Angular Storybook – WebpackOptionsValidationError: Webpack has been initialised using a configuration object that does not match the API schema

I have updated angular from 11 to 12 and I have also updated all packages to the latest versions in my package.json: { "name": "poc-architecture-angular", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve –host 0.0.0.0 –port 4200", "build": "NODE_ENV=production ng build –prod", "build:dev": "NODE_ENV=production ng build –source-map=true –prod", "build:local": "ng build –watch –output-path /usr/share/nginx/html […]

By Andy88
Published
Categorized as angular, angular-storybook, storybook Tagged , ,

Angular NGRX: What’s the best way to manage the state?

We are building a reactive application and we are in trouble on the ngrx state. One doubt is this… Now I have a state like this: tasks : [ { id: 1, name: ‘Task1’, actions: [ {id: 1, name: ‘action1’}, {id: 2, name: ‘action2’}, {id: 3, name: ‘action3’} ] }, { id: 2, name: ‘Task2’, […]

By Andy88
Published
Categorized as angular, ngrx, reactive, redux, typescript Tagged , , , ,

Angular – Check if page is refreshed or not

is there with Angular a way to check if browser is refreshed or not? I need to check if page is refreshed or not…because if only the value is false I need to execute a function. I have in an ngoninit a function like this: pageIsRefreshed: Boolean; ngOnInit() { this.subscription.pipe(). subscribe(res=> { if(!pageIsRefreshed) { dofunction(); […]

By Andy88
Published
Categorized as angular, typescript Tagged ,

Angular ngrx – and Router.Events inside Rxjs combineLatest doesn’t work

I’m in trouble with an issue that I can’t solve: onSelectCompany() { combineLatest([this.idCompany$, this.idUser$, this.router.events]).subscribe(res => { if(res[2] instanceOf NavigationEnd){ this.router.navigateByUrl(`get-info/${res[0]/res[1]`) } }) } and I call this function on ngOnInit of my component, I have two observables that I need like parameters to my url and I need to navigate on this url only […]

By Andy88
Published
Categorized as angular, ngrx, observable, rxjs Tagged , , ,

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq