Questions tagged typescript

Explore the latest questions and answers asked by our top developers.

Using HttpClient to make get requests

I have written the following code to get the dummy data here: export class AppComponent { jsonPosts: any = []; constructor(private httpClient: HttpClient) { } OnInit() { this.getJsonPosts(); } getJsonPosts(): any { return this.httpClient.get("https://jsonplaceholder.typicode.com/posts") .subscribe(response => { console.log(response); this.jsonPosts = response; }); } I have also written the following code to display them in my […]

By CatarinaRuna
Published
Categorized as angular, html, http, json, typescript Tagged , , , ,

Kendo Angular upload file with other JSON parameters

I am using KendoUI in our Angular application and we need to upload a file to backend with other details like username,description,uploadtypeid as shown in below figure I have checked with available kendo upload feature available , but it accepts only file to upload .How can I make changes to below stackblitz so I can […]

How to Launch a Universal Windows App from Angular with the URI from Browser and Pass Object to Automatically Login

How we should launch an UWP app from an angular code with URI from Browser and Pass some info to it as userid, password and other info. where we encrypt the credentials in angular app and decrypt in UMP app. Source: Angular Questions

By Shreyas
Published
Categorized as angular, encryption, typescript, uwp, windows Tagged , , , ,

Firestore, stop double querying when action on subscription

I have a function that queries my documents and returns all documents that meet the criteria of having selected set to true. This seems to work: getSelectedRepositories(): Observable<Repository[]> { return this.authService.getUser().pipe(mergeMap(user => { return this.firestore .collection(`data/${user?.uid}/repositories`, ref => ref.where(‘selected’, ‘==’, true)) .snapshotChanges() .pipe(map(actions => actions.map(a => a.payload.doc.data() as Repository))); })); } I have another function […]

Reusable typeahead component using ngx-bootstrap? Angular

I’m trying to make a component that I’m going to use in multiple places in differents components. Parent component : <app-global-autocomplete formControlName="search" (input)="searchItem($event)" [dateTime]="searchM"></app-global-autocomplete> searchItem(e: Event){ this.searchM = e.target.value } in child component where is input typeahead: <input [(ngModel)]="dateTime" [typeahead]="driverSuggestions" typeaheadOptionField="name" (typeaheadOnSelect)="onSelectedDriver($event)"> Inside ts file i using : ControlValueAccessor @Input() public dateTime: string = ” […]

By Garibald
Published
Categorized as angular, typescript Tagged ,

D3 heatmap tooltip bug ~ On mouseover the cursor changes to text cursor icon

Heatmap Cursor Error Heatmap Cursor Correct The first link shows what happens to the cursor on mouseover, this only happens sometimes and not on the whole area of the box. The second link is what should be happening. I’m not sure my error or why this may be happening. I thought it could have to […]

By Christina Closson
Published
Categorized as angularjs, d3.js, d3heatmap, typescript Tagged , , ,

how to insert a formgroup on the fisrt line of the form

I`m trying to insert a new line in my form, using .push method. This will include the new line at the last line of the form. I also tried to use unshift to put in the first line but this methos does not is included on the formgroup methods. There is any ther way to […]

By leandroter7
Published
Categorized as angular, html, methods, typescript Tagged , , ,

change color in two components using a button click

so like the title says.I have a button in books component, when it’s clicked a div color in books component and another div in navbar component should change it’s color. – this is the books component : export class BooksComponent implements OnInit { status:boolean = true ; color:boolean ; constructor(private colorService:ShareColorService) { } changeTheme(){ this.status […]

By Mohamed Ali Mani
Published
Categorized as angular, bootstrap-4, html, typescript Tagged , , ,

Angular Guard doesnt work with rxjs filter

iam trying to use RouteGuard in my app to prevent unauthorized users from accessing it. My can activate method in Guard looks like this: canActivate( route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> { return this.statusService.appStatus.pipe(filter(status=>{ return status.selectedAgency!=null; }),map(status=>{ console.log(status) if(status.selectedAgency.allowPreEdit){ return true; } else{ return false; } })) } Iam trying to filter default value […]

By Vartex05
Published
Categorized as angular, javascript, rxjs, typescript Tagged , , ,

Angular: multiple material snackbar in global ErrorHandler

I use in angular the following global ErrorHandler: @Injectable() export class GlobalErrorHandler implements ErrorHandler { constructor(private errorService: ErrorService, private messageNotificationService: MessageNotificationService) { } handleError(error: Error | HttpErrorResponse | any) { // handle api server error } else { // client Error message = this.errorService.getClientErrorMessage(error); this.messageNotificationService.showError(message); } } } and the following NotificationService with snackbar @Injectable({ […]

1 1,298

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