Angular proxy got error when I put email in payload

I use Angular developing reset password module, I need send email to backend to validate it first. I use proxy to send API request to backend, following is my proxy setting: "/api": { "target": "http://localhost:3000", "secure": false, "changeOrigin": true } Then I found this API request always got following error, even backend already received this […]

By Michael
Published
Categorized as angular, email-validation, proxy Tagged , ,

Angular RXJS Question – Object is of type ‘unknown’

I want to run the simple function as below code import { Component, OnInit } from ‘@angular/core’; import { Observable } from ‘rxjs’; import { map, filter } from ‘rxjs/operators’ @Component({ selector: ‘app-root’, templateUrl: ‘./app.component.html’ }) export class AppComponent implements OnInit { objectdata = []; obs1 = new Observable((observer) => { observer.next(1) observer.next(2) observer.next(3) observer.next(4) […]

By Michael
Published
Categorized as angular, rxjs Tagged ,

How to change the columns in Angular in a way that they resize to show the whole date in one line

I am creating a form, and once I search, it gives me results in an ag grid angular table. The data in the columns sometimes breaks and causes it to be in 2 lines instead of 1, how can I make the columns shift in size (and make other columns nearby smaller if needed to) […]

By Michael
Published
Categorized as ag-grid-angular, angular, html Tagged , ,

I already mocked the service why still get error with not injecting dependency of service?

I am writing my unit test for my Angular component, in one component I called service which helping register reader in backend. In test, I mocked the service, but each time I still get error with not injecting dependency of the original service, why? My understanding is we should not consider those dependencies once I […]

Angular 12 with ERROR TypeError: this.handleError is not a function

I am developing a web APP using Angular 12. I used a global error handler to process all my http errors. In my book portal component (in book module), When I called ReaderService function (getFavorList) from another reader module, got an error: TypeError: this.handleError is not a function. If I call this function in same […]

By Michael
Published
Categorized as angular, error-handling, javascript, this Tagged , , ,

Is there an equivalent in Angular to Vue.js keep-alive and component?

I am learning Vue.js and I tried the keep-alive and component mechanism which allows to dynamically switch between components. As far as I have understood, I can do something like this: <template> <section> <button @click="setSelectedTab(‘section-a’)">Section A</button> <button @click="setSelectedTab(‘section-b’)">Section B</button> </section> <keep-alive> <component :is="selectedTab"></component> </keep-alive> </template> export default defineComponent({ name: "SomeComponent", components: { SectionA, SectionB, }, […]

How to execute function one after another?

I use angular 10 in my project. I have two functions initData1 and initData2. I have two functions: initData1(){ //some http client services } initData2(){ //some http client services } Here how I call functions in my component: ngOnInit(): void { initData1(); initData2(); } My question is how to execute the initData2 function only after […]

Passing enum item to child component in template

I try to pass enum item to the child compoenent: <app-enum-selection [itemIgnore]=DataStatus.Coming_Soon ></app-enum-selection> But I get this error: error TS2339: Property ‘DataStatus’ does not exist on type ‘ConstructorComponent’. <app-enum-selection [itemIgnore]=DataStatus.Coming_Soon></app-enum-selection> src/app/constructor/constructor.component.ts:29:16 templateUrl: ‘./constructor.component.html’, Error occurs in the template of component ConstructorComponent. Any Idea why I get error? And how to pass enum item to child […]

By Michael
Published
Categorized as angular Tagged

How can attributes be hidden under specific requirements?

I have this element defined in template: <mat-accordion class="" [multi]="true" hideToggle> </mat-accordion> I need to disable hideToggle attribute in the element above when the page is displayed on the device. How can attributes be hidden under specific requirements? Source: Angular Material Quesions

By Michael
Published
Categorized as angular-material Tagged

How can I fire function or what event after data is bounded to the component?

I use angular material select in my angular 10 project. Here is template: <mat-form-field appearance="fill"> <mat-select [(ngModel)]="defaultSelection" (selectionChange)="onSelect($event)"> <mat-option *ngFor="let name of enumKeys" [value]="name"> {{enum[name]}} </mat-option> </mat-select> </mat-form-field> Here is component: export class EnumSelectionComponent implements OnInit { @Input() enum: Object = Status; defaultSelection = Status.Info; enumKeys=[]; constructor() { this.enumKeys=Object.keys(this.enum); } onSelect(selection) { alert(selection) } ngOnInit(): […]

By Michael
Published
Categorized as angular, angular-material, typescript, web 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