Categories
Mastering Development

How to do a calculation using angular

I am new to angular and I am trying to calculate the salary of an employee when his ID, his base salary and the relevant month is given. For this, I should add the total additions and substract the total deductions from the base salary to calculate the final salary. Currently I am having this […]

Categories
Mastering Development

Unsubscribe to observable when navigating away from an onsen ui page

I have an angular 2+ app running onsen ui, I have setup some components as pages and I am using the ons-navigator to switch between them. The problem im having is that when im subscribed to an observable in an ons-page and the user navigates away from that page, The observable is still active. It […]

Categories
Mastering Development

Cloud Firestore – How to paginate data with RXJS

I would like to get data from the Cloud Firestore collection (limited to 10), and then after clicking the "load more" button, I would like to get another piece of collection and concat with the previous result. My code is (base on https://firebase.google.com/docs/firestore/query-data/query-cursors): import { Component, OnDestroy, OnInit } from ‘@angular/core’; import { User } […]

Categories
Mastering Development

Video JS in Angular 9 – live video – ‘Can’t resolve videojs’ problem?

I am struggling to get the videojs to work in my angular 9 app. I have viewed all the exisitng stackoverflow posts, applied their solution, looked at different blog posts and github for issues with video js but I still have the ‘Can’t resolve videojs’ problem. I would like it to work in that an […]

Categories
Mastering Development

How can I pass a token (string) from an input page to service and use it for API requests in Angular2?

I have a project, in which I will have a homepage, a service and a page where the API requests are called. I want to take a string from tha input fild and pass it to service to use it as token in Authentication. The problem is that it seems tha when I route to […]

Categories
Mastering Development

CORS issue on Google Cloud Platform using Python, Flask & Angular

I am developing a single page web application using Python, Flask & Angular on GCP (google cloud platform) and have run into a stubborn issue related to CORS. When I build and serve the frontend I get the following error: Access to XMLHttpRequest at ‘https://jsonData-devshell.appspot.com/org‘ from origin ‘https://mySPA-devshell.appspot.com‘ has been blocked by CORS policy: No […]

Categories
Mastering Development

Is correct onclick method always call ngOnInit method?

I have the fllowing html page with Angular: <div class=”example-container mat-elevation-z8″> <div class=”example-loading-shade” *ngIf=”isLoadingResults”> <mat-spinner *ngIf=”isLoadingResults”></mat-spinner> </div> <div class=”button-row”> <a mat-flat-button color=”primary” [routerLink]=”[‘/products’]”><mat-icon>list</mat-icon></a> </div> <mat-card class=”example-card”> <mat-card-header> <mat-card-title><h2></h2></mat-card-title> <mat-card-subtitle></mat-card-subtitle> </mat-card-header> <mat-card-content> <dl> <dt>Product Price:</dt> <dd></dd> <dt>Updated At:</dt> <dd>Liquid error: wrong number of arguments (given 1, expected 2)</dd> </dl> </mat-card-content> <mat-card-actions> <a mat-flat-button color=”primary” (click)=”editProduct()”><mat-icon>edit</mat-icon></a> <a […]

Categories
Mastering Development

How to get the name menu in navigation when I click it in Angular

I have an issue with my Angular project. I can’t get only one component of menu and put it on nav to show which menu is clicked. This is my header.component.html <mat-nav-list> <mat-list-item> <a style=”color: white;” *ngFor=”let menuitem of menuItems.getMenuitem()”></a> </mat-list-item> </mat-nav-list> This is my header.component.ts import { MediaMatcher } from ‘@angular/cdk/layout’; import { Router […]

Categories
Mastering Development

How to get the name menu in navigation when i click on it. project is in Angular

I have an issue with my angular project. I can’t get only one component of menu and put it on nav to show which menu is clicked. I have to get som answers because im not getting where the problem is. This is my header.component.html because i dont have anything else there. <mat-nav-list> <mat-list-item> <a […]

Categories
Development

Reducer issues after updating to Angular 9

I am receiving the following error when I compile my app. I’m not sure exactly what it means. I’m fairly new to angular, and I’m trying to update some legacy code to a new version of angular. Any direction would be very greatly appreciated. src/app/app.module.ts:30:9 – error TS2322: Type ‘{ app: typeof AppState; }’ is […]