angular

Reading zip file contents and assign it to local variable

孤人 提交于 2021-02-10 17:26:09
问题 I want to read contents of zip file that contains multiple files and merge content from all the files and assign it to local variable. But local variable is not in scope in below code: const jsZip = require('jszip'); jsZip.loadAsync(fileList[0]).then(function (zip) { Object.keys(zip.files).forEach(function (filename) { zip.files[filename].async('string').then(function (fileData) { this.fileData = this.fileData + '**$$##$$**' + fileData; }); }); }); 'this' is undefined here because this is

Multiple dispatches while using ngrx/store

萝らか妹 提交于 2021-02-10 17:07:15
问题 I am working on a sample Angular 2 application , and using ngrx/store , ngrx/effects for state management. Below image depicts one of the screens of my application. In order to display books list , categories and authors from the server, below dispatch calls are made to the store. this.store.dispatch(loadCatgories()); this.store.dispatch(loadAuthors()); this.store.dispatch(loadBooks()); And below the are the related effects @Effect() authors$ = this.actions$ .ofType(AuthorActionTypes.LOAD

Reading zip file contents and assign it to local variable

那年仲夏 提交于 2021-02-10 17:05:35
问题 I want to read contents of zip file that contains multiple files and merge content from all the files and assign it to local variable. But local variable is not in scope in below code: const jsZip = require('jszip'); jsZip.loadAsync(fileList[0]).then(function (zip) { Object.keys(zip.files).forEach(function (filename) { zip.files[filename].async('string').then(function (fileData) { this.fileData = this.fileData + '**$$##$$**' + fileData; }); }); }); 'this' is undefined here because this is

My Angular 6 routing returns 404 after page refresh behind Nginx proxy

给你一囗甜甜゛ 提交于 2021-02-10 16:51:41
问题 I have my angular app running inside docker that exposed on port 83, and I also have a spring-boot rest app inside another docker that exposed on port 8083. In the host server I have one Nginx server that reroute every requests using below config: server { listen 80; server_name mydomain.com; location / { proxy_pass http://127.0.0.1:83; } } server { listen 80; server_name rest.mydomain.com; location / { proxy_pass http://127.0.0.1:8083; } } With above config, every request that uses mydomain

My Angular 6 routing returns 404 after page refresh behind Nginx proxy

跟風遠走 提交于 2021-02-10 16:50:40
问题 I have my angular app running inside docker that exposed on port 83, and I also have a spring-boot rest app inside another docker that exposed on port 8083. In the host server I have one Nginx server that reroute every requests using below config: server { listen 80; server_name mydomain.com; location / { proxy_pass http://127.0.0.1:83; } } server { listen 80; server_name rest.mydomain.com; location / { proxy_pass http://127.0.0.1:8083; } } With above config, every request that uses mydomain

Image/Video Preview In Angular

依然范特西╮ 提交于 2021-02-10 16:49:26
问题 I'm trying to upload image or video in Angular. I wanted to display its preview. I have no problem in previewing the image, my problem is how can i preview the video? Please see this stackblitz link: CLICK HERE CODE onSelectFile(event) { if (event.target.files && event.target.files[0]) { var reader = new FileReader(); reader.readAsDataURL(event.target.files[0]); reader.onload = (event) => { this.url = event.target.result; } } } 回答1: You can decide if the file is type of video/image and then

How to dispatch an action with current value of state?

落爺英雄遲暮 提交于 2021-02-10 16:40:02
问题 I have an angular component showing items in a list. Each itemn can be selected and the ids of the selected items will be stored in the state. So my state object looks like this f.e.: { items: Item[]; selected: string[] } Now I got an action called DeleteSelectedAction that gets selected as payload. This action will call some WebAPI using an effect and so on. Now I found two ways how I could do this. First: Select selected from store and subscribe to it and pass the value with the action

Remove selected option from dropdown after select

六眼飞鱼酱① 提交于 2021-02-10 16:38:23
问题 I have a scenario that i need to show dropdowns with selected or default values in view if there is any data from API. And i can add new dropdowns using add button. But i have to select value from drop downs only once so it will not repeated. I am using ngFor loop to show this drop downs and i am using splice method to remove selected options from drop down. And i am facing a issue here that Example: If i select car 1 from 1st drop down 1 and the 2nd drop down i can not see car 1 but if i go

Event triggered on all elements generated by ngFor in angular 7

不打扰是莪最后的温柔 提交于 2021-02-10 16:30:00
问题 I have an Order screen where I have a list of items to buy. In front of every item, I have a plus and minus button and an input field where I can specify the quantity of the item I need to buy. I am using *ngFor to iterate through an array and display the items. Even I am creating plus button, minus button and an input text field for that item using this *ngFor. I am using 2-way data binding to get and set the data into the input field. But, the issue is, when I click the increment button,

Event triggered on all elements generated by ngFor in angular 7

时间秒杀一切 提交于 2021-02-10 16:29:13
问题 I have an Order screen where I have a list of items to buy. In front of every item, I have a plus and minus button and an input field where I can specify the quantity of the item I need to buy. I am using *ngFor to iterate through an array and display the items. Even I am creating plus button, minus button and an input text field for that item using this *ngFor. I am using 2-way data binding to get and set the data into the input field. But, the issue is, when I click the increment button,