Avoid duplicate styles in Angular Material theme

Issue I have a styles.theme.scss that looks like the following. @media (prefers-color-scheme: dark) { @include example-theme($dark-theme); } @media (prefers-color-scheme: light) { @include example-theme($light-theme); } [data-theme="dark-theme"] { @include example-theme($dark-theme); } [data-theme="light-theme"] { @include example-theme($light-theme); } The goal is to use the

Continue reading

How to retain the pagination number, after reloading the page

Issue I am using Angular PrimeNG Paginator Component (i.e p-paginator). The HTML part of the code looks like : <div class="paginator paginator-product mb-5"> <p-paginator [rows]="12" pageLinkSize="6" [alwaysShow]="false" [showCurrentPageReport]="true" [totalRecords]="totalRecords" #paginator (onPageChange)="onPageChange($event)"></p-paginator> </div> Here the issue is that, suppose current page

Continue reading

Angular Jasmine, unit test case fails when global variable assigned

Issue I have a basic unit-test case written for two methods. it(‘should populateChartDatasets call getColorCodes’, () => { component.chartConfig = mockChartConfig; spyOn(component, ‘getColorCodes’); component.populateChartDatasets(filteredTreatments, filteredYears); expect(component.getColorCodes).toHaveBeenCalled(); }); method populateChartDatasets firstly supposed to pick colorCode from method getColorCodes then push prepared

Continue reading

Select value by text from a dynamic non select dropdown using Selenium Java

Issue I want to select value by text from a dynamic non select dropdown. I did some research and I found this code: WebElement element = driver.findElement(ByMapper.getBy(dropdown)); element.click(); List<WebElement> options = element.findElements(By.xpath("/html/body/div[1]/div[2]/div/div/div")); for (WebElement option : options){ if (option.getText().contains(text)){ option.click();

Continue reading

Unable to uninstall or update Angular CLI from Mac

Issue I have following versions currently installed Angular CLI: 9.1.9 Node: 17.4.0 OS: darwin x64 Angular: … Ivy Workspace: Package Version —————————————————— @angular-devkit/architect 0.901.9 @angular-devkit/core 9.1.9 @angular-devkit/schematics 9.1.9 @schematics/angular 9.1.9 @schematics/update 0.901.9 rxjs 6.5.4 Since I was not able to

Continue reading

How can I add background image to Angular selector?

Issue I am trying to add background image to Angular selector, but its not working for me. Below is the code <app-highway-card [ngStyle]="{‘background-image’:’url(https://cdn.pixabay.com/photo/2021/09/04/09/32/road-6597404__340.jpg)’}" [highway]="highway"></app-highway-card> Solution Add display: ‘block’ to the styles: [ngStyle]="{‘background-image’:’url(https://cdn.pixabay.com/photo/2021/09/04/09/32/road-6597404__340.jpg)’, display: ‘block’}" Stackblitz: https://stackblitz.com/edit/angular-ivy-zmjsjo?file=src%2Fapp%2Fapp.component.html Answered By – wlf

Continue reading

Get Data Object From Array On Angular

Issue I have data retrieved from the API in the following form [ { "end_date": 1640908800000, "rev": 151, "usage_limit": 0, "reason_deleted": null, "picture_detail": "test", "revtype": 0, "linked_type": "SPECIFIC", "modified_date": 1644893309181, "type": "OPEN", "created_by": "januardy.hp@gmail.com", "is_multiple": null, "campaign_name": "Blewah 2022", "is_deleted":

Continue reading

Why don't my variables change after http request?

Issue larnacaCount=0; nicosiaCount=0; private array :number[] = []; constructor(private http: HttpClient, private popupService: PopupService) { } makeCapitalMarkers(map: L.Map): any { this.http.get(this.capitals).subscribe((res: any) => { this.larnacaCount=res.larnaca; //should return 3 this.nicosiaCount=res.nicosia; //should return 1 console.log(res); for (const c of res.features) { const

Continue reading

In an Electron Application I am successfully making an HTTP GET request from an Angular component. How can I do the same thing from the Electron side?

Issue The following function is working from an Angular component in my Electron app: getData() { const url = ‘https://reqres.in/api/users?page=1’; this.http.get<any>(url).toPromise() .then(response=> { //… alert(JSON.stringify(response)); }); } The alert prints out the same text as you will see if you

Continue reading

Login using laravel and angular using jwt

Issue I’m using angular and Laravel for user authentication followed this link : https://www.positronx.io/laravel-jwt-authentication-tutorial-user-login-signup-api/ https://www.positronx.io/laravel-angular-token-based-authentication-with-jwt/ Authentication is working, this is login function : onSubmit() { this.authService.signin(this.loginForm.value).subscribe( (result: any) => { this.responseHandler(result); }, error => { this.errors = error.error; if(this.errors.error_message) {

Continue reading

"ERROR in getInternalNameOfClass() called on a non-ES5 class: expected AngularFireModule to have an inner class declaration"

Issue Terminal – "WARNING in Invalid constructor parameter decorator in D:/New folder/SilverLife/node_modules/@angular/fire/fesm2015/angular-fire.js: () => [ { type: Object, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] } ] ERROR in getInternalNameOfClass() called on a non-ES5 class: expected AngularFireModule to have an

Continue reading