angular6

Service instantiated twice after APP_INITIALIZER

亡梦爱人 提交于 2021-01-23 06:22:13
问题 Problem is: I need to make an http call and store an object that is needed for generate dynamic routes. So, I was taking advantage of the APP_INITIALIZER. // app.module.ts import { ApplicationService } from './application.service'; providers: [ ApplicationService, { provide: APP_INITIALIZER, useFactory: appServiceFactory, deps: [Injector, ApplicationService], multi: true }, ], function appServiceFactory(injector: Injector, appService: ApplicationService): Function { return () => { return

TypeError: expected bytes-like object, not str

我的梦境 提交于 2021-01-22 06:45:47
问题 I know this question has been asked much times, but please look once in my problem. I am sending base64 image data from angular to python flask but when I am processing that base64 data on flask server(python3) then it is giving me the error TypeError: expected bytes-like object, not str My Javascript code is: window['__CANVAS'].toDataURL("image/png"); Output of the above line is: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg....." I am receiving same data on flask server as string. Code on

My angular 7 apps sitemap.xml is not being picked up by webmaster tools

空扰寡人 提交于 2021-01-21 10:37:27
问题 My angular 7 apps sitemap.xml is not being picked up by webmaster tools I have this sitemap.xml file (I've hidden real names): <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> <url> <loc>https://mywebsite.co.uk/</loc> <lastmod>2018-11-28T13:11:30+00:00</lastmod> </url> <

Angular 6: get reference to Components created with *ngFor inside ng-container tag

烂漫一生 提交于 2021-01-05 12:00:09
问题 I'using ng-container to iterate on a list and create components <ng-container *ngFor="let f of optionsList; let i = index;"> <!-- component--> <app-component #fieldcmp *ngIf="isAppComponent(f)" ></app-field> <!--another components--> <app-anoter-component1 *ngIf="isAnotherComponent1(f)"> </app-anoter-component1> ... <app-anoter-componentn *ngIf="isAnotherComponentn(f)"> </app-anoter-componentn> </ng-container> I would to list of References components inside ng-container. I tried to use

Angular 6: Download file after getting File object from backend server

喜你入骨 提交于 2021-01-03 16:11:52
问题 I have a File object type of structure {type: "Buffer", data: Array(702549)}, what do I need to do in angular 6 in order to download this file in browser? I get my response from this function: getMarketingProposalById(id: string): Observable<MarketingProposal> { return this.httpClient.get<MarketingProposal>(this.apiUrl + id , this.httpOptions).pipe(map(marketingProposal => { if (marketingProposal.materials[0] && marketingProposal.materials[0].file) { const blob = new Blob([marketingProposal

Angular 6: Download file after getting File object from backend server

只谈情不闲聊 提交于 2021-01-03 16:10:14
问题 I have a File object type of structure {type: "Buffer", data: Array(702549)}, what do I need to do in angular 6 in order to download this file in browser? I get my response from this function: getMarketingProposalById(id: string): Observable<MarketingProposal> { return this.httpClient.get<MarketingProposal>(this.apiUrl + id , this.httpOptions).pipe(map(marketingProposal => { if (marketingProposal.materials[0] && marketingProposal.materials[0].file) { const blob = new Blob([marketingProposal

How to do filter in angular material data table for specific column

非 Y 不嫁゛ 提交于 2021-01-01 17:50:38
问题 i am trying angular material data table. As we know filtering happened for each row by default. If i want to filter column specific, then what should i do? Should i have to write method for getting all records, then iterate over it and compare specific column? component.ts ngOnInit() { this.service.getUser().subscribe( results => { if(!results){ return; } console.log(results); this.dataSource = new MatTableDataSource(results); this.dataSource.sort = this.sort; }) onSearchClear(){ this

How to do filter in angular material data table for specific column

回眸只為那壹抹淺笑 提交于 2021-01-01 17:49:54
问题 i am trying angular material data table. As we know filtering happened for each row by default. If i want to filter column specific, then what should i do? Should i have to write method for getting all records, then iterate over it and compare specific column? component.ts ngOnInit() { this.service.getUser().subscribe( results => { if(!results){ return; } console.log(results); this.dataSource = new MatTableDataSource(results); this.dataSource.sort = this.sort; }) onSearchClear(){ this

How to do filter in angular material data table for specific column

心已入冬 提交于 2021-01-01 17:47:21
问题 i am trying angular material data table. As we know filtering happened for each row by default. If i want to filter column specific, then what should i do? Should i have to write method for getting all records, then iterate over it and compare specific column? component.ts ngOnInit() { this.service.getUser().subscribe( results => { if(!results){ return; } console.log(results); this.dataSource = new MatTableDataSource(results); this.dataSource.sort = this.sort; }) onSearchClear(){ this

How to do filter in angular material data table for specific column

爷,独闯天下 提交于 2021-01-01 17:46:18
问题 i am trying angular material data table. As we know filtering happened for each row by default. If i want to filter column specific, then what should i do? Should i have to write method for getting all records, then iterate over it and compare specific column? component.ts ngOnInit() { this.service.getUser().subscribe( results => { if(!results){ return; } console.log(results); this.dataSource = new MatTableDataSource(results); this.dataSource.sort = this.sort; }) onSearchClear(){ this