angular6

TestBed overrideModule method seem to remove previously added providers

折月煮酒 提交于 2019-12-25 03:32:51
问题 Does TestBed.overrideModule replace previously added providers? I have a Component c1 which uses a dynamically created component c2 . I read that I need to use overrideModule to add entryComponents entry in the TestBed . So I did this TestBed.configureTestingModule({ declarations: [ NewPracticeQuestionComponent, DialogBoxComponent, ShowErrorsComponent], imports:[ReactiveFormsModule,HttpClientTestingModule], providers:[WebToBackendInterfaceService, HelperService, AuthService, {provide

How to set two way binding data in dropdown in angular 6?

自闭症网瘾萝莉.ら 提交于 2019-12-25 03:23:03
问题 I have a data like this. [ { "user_id": 1, "name": "John" }, { "user_id": 2, "name": "Doe" }, ... ] In app, I have set two dropdown for show only user_id and name respectively. For user id I have used simple select and option . For name I have used ngx-select-dropdown . Now I have to make two way binding, when I select Doe then id dropdown 2 will automatically bind. Same way if I choose id 1 then John will autimatically select. I have a design like below. 回答1: To dynamically generate a drop

Error in Kendo ui controls with Angular 6

柔情痞子 提交于 2019-12-25 03:18:13
问题 I have created project in Angular 6. In that project at first i have successfully installed @progress/kendo-angular-dateinputs using npm install then project was building successfully. After running ng-serve , following error occurs: node_modules/@progress/kendo-angular-dateinputs/dist/es2015/calendar/header.component.d.ts(2,37): error TS2307: Cannot find module '@progress/kendo-angular-l10n'. node_modules/@progress/kendo-angular-dateinputs/dist/es2015/calendar/header.component.d.ts(3,29):

Getting ExpressionChangedAfterItHasBeenCheckedError error I update property of a Component from another Component

 ̄綄美尐妖づ 提交于 2019-12-25 03:14:37
问题 The demo is available here - https://stackblitz.com/edit/angular-a9wcee Please open the console window to see the error. Description I have a Bootstrap component ComponentA which should start up in two different ways depending on the application's startup process. Say if the application is started using url home.com then ComponentA should not show a pop up dialog on startup but if the application is started using home.com;signup then the application should show a pop up. I have read that

how to upload a file on form submit using web api and angular

为君一笑 提交于 2019-12-25 03:07:57
问题 I want to upload a file on form submit, its not posting on Web API. I want to save file in a local physical path using Web API. I am getting this error. POST http://localhost:35257/api/Employee/Create 500 (Internal Server Error). Html : <form [formGroup]="employeeForm" (ngSubmit)="save()" #formDir="ngForm" novalidate style="position:relative;"> <div> <input class="form-control" type="text" formControlName="Name"> <input type="file" id="FileUploader" (change)="onFileChange($event)" #fileInput

Angular2 radio button validation

三世轮回 提交于 2019-12-25 02:47:24
问题 How to validate radio button and checkbox and zip code in angular 2 i tried but not working.Anyone can find the solutions.please help me to resolve this issue. Demo:https://stackblitz.com/edit/angular-7-template-driven-form-validation-ndspdl?file=app/app.component.html <div class="form-group"> Radio Buttons: <div *ngFor="let enum of enum_details"> <label for="enum_answer_{{enum.name}}"> <input id="enum_answer_{{enum.name}}" [value]='enum.name' type="radio" name="enums" enums="ngModel" [

Setting the map as a variable in angular6/openlayers

喜欢而已 提交于 2019-12-25 02:18:11
问题 I use angular 6 and openlayers 5.1.3. I did npm install ol --save successfully and then in my angular I did import OlMap from 'ol/map'; import OlXYZ from 'ol/source/xyz'; import OlTileLayer from 'ol/layer/tile'; import OlView from 'ol/View'; import * as OlProj from 'ol/proj'; import 'ol/ol.css'; export class myComponent { olmap: OlMap; source: OlXYZ; layer: OlTileLayer; view: OlView; //other, non-ol stuff loading: boolean = false; myname: String; ngOnInit() { this.source = new OlXYZ({ url:

Angular 6- canvas.toDataURL('image/png') not capturing canvas background image

旧街凉风 提交于 2019-12-25 02:16:45
问题 Currently I am choosing one image from device gallery and using that picture as a background image for canvas. After I draw something I want to save the image. But whenever I am trying to save the image, canvas will get saved with transparent background. It's not taking background image source. Below is my code. I can see image on canvas but not capturing while saving canvas as an image. 1. HTML <canvas no-bounce id="canvas" (touchstart)='handleStart($event)' (touchmove)='handleMove($event)'

I can't deploy an Angular app to heroku

末鹿安然 提交于 2019-12-25 02:15:51
问题 I am trying to deploy my angular 6 app on Heroku, After building the project and following all the steps of deploy, I get this result on heroku: and th Heroku logs is : when testing the deploy address, we get this result: Your help is highly appreciated 回答1: You will have to add wildcard get route in server.js as: app.use(express.static(__dirname + '/dist')); app.get('/*', function(req, res) { res.sendFile(path.join(__dirname + '/dist/index.html')); }); Solution 2 add one index.php file in

How to change one server URL to another server URL, if the server is down in angular6

末鹿安然 提交于 2019-12-25 01:53:16
问题 I have 4 servers with different URLs, i want to change one server URL to another server URL if server is down in angular 6 application, if anyone knows please help me. Consider i have 4 servers with different URLs(1st,2nd,3rd and 4th), here 1st server is having more priority and i want to make it has default. and my question is how to change 1st server URL to 2nd server URL as same as for 3rd and 4th also, if servers are down. Any help would be appreciated and thanks in advance. service.ts