angular7

In angular 7 , How do I populate a mat-table with a data from an object

邮差的信 提交于 2020-01-15 10:34:31
问题 Currently I have the following code to populate a table. In component.ts: import { HttpClient } from "@angular/common/http"; import { Component, OnInit } from "@angular/core"; import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { ActivatedRoute, Router } from "@angular/router"; import { MatTableDataSource } from "@angular/material/table"; @Component({ styleUrls: ["./styles.scss"], templateUrl: "./template.html" }) export class MyRouteData { employeeInfoTable: object;

Getting OAuth tokens for Azure DevOps API consumption

你。 提交于 2020-01-15 08:50:14
问题 I have a web app written in Angular 7. I'm trying to consume Azure DevOps APIs and I understand that I have to setup an Azure Active Directory App. I have tried few libraries like adal-angular msal-angular and wrappers like microsoft-adal-angular6 . Followed their documentations and samples. I can successfully access the User's name, emails and a token. I can use the token for Microsoft Graph apis but not for Azure DevOps apis. I tried using this token as a Authentication Bearer for my

How do we import Blockly into an Angular 7 application?

一世执手 提交于 2020-01-14 18:57:23
问题 I'm trying to use Blockly in an Angular 7 application but I'm unable to inject the Blockly editor. I have downloaded the files from https://developers.google.com/blockly/guides/get-started/web and copied blockly_compressed.js into my src directory (and renamed it blockly.js). I then try to access Blockly from my component and get errors. What I have tried: import "../blockly.js" Does not compile, gives "error TS2304: Cannot find name 'Blockly'." import { Blockly } from '../blockly' Compiles,

How do we import Blockly into an Angular 7 application?

女生的网名这么多〃 提交于 2020-01-14 18:55:25
问题 I'm trying to use Blockly in an Angular 7 application but I'm unable to inject the Blockly editor. I have downloaded the files from https://developers.google.com/blockly/guides/get-started/web and copied blockly_compressed.js into my src directory (and renamed it blockly.js). I then try to access Blockly from my component and get errors. What I have tried: import "../blockly.js" Does not compile, gives "error TS2304: Cannot find name 'Blockly'." import { Blockly } from '../blockly' Compiles,

Angular SSR - ReferenceError: Element is not defined

送分小仙女□ 提交于 2020-01-14 14:32:14
问题 I have an angular 7 project that I'm developping. I use server-side rendering to allow facebooks crawler to work properly. Until now, I've developped already some components and haven't encountered any troubles yet. But now I'm having a problem since I'm working on a component using fullcalendar... There are no troubles serving the application using ng s . But when I try to build the application using server-side rendering npm run build:ssr && npm run serve:ssr , I'm now receiving the

Angular Viewmodels and usage in components

大城市里の小女人 提交于 2020-01-14 04:08:43
问题 I'm trying to bind viewmodels to a view through component. Initially I did this in the component and it was almost working: model: any = { TenantId: '', CustomFieldName: '', quantities: [] }; quantity: any = { price: '', name: '' } Then on button click for adding new object of model I was doing this: addNewQuantity() { if (this.newQuantity) { this.quantity.name = this.newQuantity; this.model.quantity.push(this.quantity); this.newQuantity = ''; } } The issue with above event was that the same

Angular 7 i18n translation inside service, component and without template

北城以北 提交于 2020-01-13 17:14:12
问题 I am trying to migrate from ngx-translate to Angular i18n approach and wanted to make sure a few points before migration. Is it possible to translate inside the service and component without any template? In ngx-translate it was possible using translate pipe. Is there any approach which angular has introduced for V7 or planning to introduce in v8 for translating inside component and service level? Is this currently only possible using workaround and there is no angular way to do it? If yes,

Angular 7 i18n translation inside service, component and without template

纵然是瞬间 提交于 2020-01-13 17:13:13
问题 I am trying to migrate from ngx-translate to Angular i18n approach and wanted to make sure a few points before migration. Is it possible to translate inside the service and component without any template? In ngx-translate it was possible using translate pipe. Is there any approach which angular has introduced for V7 or planning to introduce in v8 for translating inside component and service level? Is this currently only possible using workaround and there is no angular way to do it? If yes,

Rxjs catchError not working when subscribe after pipe

*爱你&永不变心* 提交于 2020-01-11 14:46:48
问题 I have created an observable to consume an API Observable:- return this.http.post('/api/ApplicationUser/Login', loginDetails, httpOptions).pipe( map((result: any) => { localStorage.setItem('jwtToken', result.jwtToken); localStorage.setItem('refreshToken', result.refreshToken.value) localStorage.setItem('UserName', result.userName); return result; }), catchError((err: any) => { //this.userLogout() console.log('refresh error') return throwError(err); }) ); } Above code is working fine by

Is there a way to download a csv file of the data from a SQL Server database table on button click in Angular

不问归期 提交于 2020-01-11 07:46:12
问题 I need to get all of the data in my SQL Server database table into a .csv file when I click a button in a front end Angular web page. I have already written a Web API in C# to access all the data from the SQL Server table and display it in my web page. I need to be able to download a .csv file when I click a button with all that data in the table displayed on my page. export class EmployeeService { url = 'https://localhost:44395/Api/Employee'; constructor(private http: HttpClient) { }