angular4-forms

Angular2/4 post method not working

天大地大妈咪最大 提交于 2019-12-13 04:43:32
问题 I am new in angular2/ 4 web api. I want to save some data to database using angular 4 web api http. When i call a GET method from angular it works fine, but not working on POST method. I am getting 415 Unsupported Media Type.All the time, but when I use postman the post method is work fine because I change the content type to application/json. when i use alert button i get [object,Object],But in angular2/4 it's not working... I see lots of issues with the same problem, but they don't work for

Angular4 search filter functionality on Entire table

梦想与她 提交于 2019-12-13 04:33:32
问题 Here i Implemented small search filter on a table But My Requirement is its should search whole the table not within the page? search <label> Search FRom Table:</label> <input (change)="someval($event.target.value)"> someval(value){ let data=JSON.stringify(value); console.log(data.length); this.auction.find(e=>e.uniqueid=data); this.GetDashBoardData(); } GetDashBoardData(){ var somedata= this.globalService.getBasicInfoData(); this.auctionRequest = { "loginId": this.userdata.LoginID }; return

Custom Form Input not binding to model

落爺英雄遲暮 提交于 2019-12-13 03:36:42
问题 I am trying to make a custom form input in Angular 4. This is a simple example, but I cannot get the component to bind to the ngModel. I can pass this component a default value from the parent controller, but when I change a value in this input, the UI registers the change, but the model in the controller is not showing the new value. Here is my custom component: import { Component, Input, forwardRef, Output, EventEmitter, ElementRef, Renderer } from '@angular/core'; import {

how to get selected value of dropdown in reactive form

对着背影说爱祢 提交于 2019-12-13 03:19:31
问题 I am trying to get the selected value of the dropdown on change event to be sent on reactive form submission. I have a very similar scenario working for radio based on the answer from how to get selected value of radio in reactive form Here's the code for dropdown <div class="row" *ngIf="question.controls.type.value === 'dropdown'"> <div class="col-md-12"> <div class="form-group__text select"> <label for="type">{{ question.controls.label.value }}</label> <br><br> <select name="value"

How to capture bind event of select element using formcomtrol - ReactiveFomrModule -Angular 4

孤街浪徒 提交于 2019-12-11 15:49:18
问题 I am using reactiveformmodule and has created a formcontrol for select tag. On load of the page I am fetching data from backend and binding it using patchvalue to the selectformcontrol. But in doing this the change event of select is not fired. in .html <select id="businessType" formControlName="businessType"> <option value="-1">Business type</option> <option *ngFor="let business of businessTypes; let i=index;" [value]="i">{{business.b_type}}</option> </select> in .ts this.formGroupObject

md-option within md-select Angular Material 2.0.0 beta 10

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 14:10:06
问题 Select All option for selecting all the values in md-option with in md-select. I am populating md-option by using ngFor and i am using formControl. I can see the checkboxes for all the md-option values. But I am not able to check all the checkboxes from typescript(.ts) file. How do put select all option? I am trying control.setValue(arrayvalues); But it doesn't check the checkboxes. 回答1: I wrote [compareWith] = compareById(obj1, obj2) attribute for md-select in my HTML page and in the .ts

Get All Materials from Array in Angular

帅比萌擦擦* 提交于 2019-12-11 12:13:48
问题 I have this code in stackblitz that needs to get all materials. How can i get all the materials and not just one. The output is just one materials and not the lists? Here's my code below https://stackblitz.com/edit/angular-qssycg?file=app/app.component.ts JSON orders = [ { "id": 1, "name": "Not Available", "address": "Not Available", "city": "Not Available", "contact_number": "Not Available", "created_at": "2017-10-26 16:12:22", "updated_at": "2017-10-26 16:12:22", "materials": [ { "id": 21,

Angular 6: Can't bind to 'FormGroup' since it isn't a known property of 'form'

久未见 提交于 2019-12-11 08:59:18
问题 I am new to Angular 6 and working on ReactiveForms. Getting this error and unable to compile. I have seen the different solutions and Added the ReactiveFormsModule directive in Imports as suggested in solutions still it is showing the same error. Please Help. Sharing you the desired code and screenshot of the error. app.module.ts import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { SignupFormComponent } from './signup-form/signup-form.component'; import { AuthorsService

Calling the CSS style from typescript append it to html file

送分小仙女□ 提交于 2019-12-11 06:40:55
问题 On button click function CSS style to be called with in the TS file html code: <div class="overlay-loader"> <div *ngIf="isLoading" class="loader"></div> <p *ngIf="results">{{ results | json }}</p> <p *ngIf="error">Error: {{ error | json }}</p> </div> <p> <button (click)="getResult()">Get result</button> </p> Link which i have tried:https://stackblitz.com/edit/angular-loader-kspfhg?ctl=1&embed=1&file=app/app.component.html&view=editor After clicking the button overlay-loader css class to be

angular 4 reactive forms with material 2, disabling autocomplete

十年热恋 提交于 2019-12-11 04:29:27
问题 I'm using angular cli, angular 4 and angular material 2. I need to disable chrome autocomplete, but I'm not being able to do so. I already searched and found out that I need to add autocomplete=off or autocomplete=false both in the form and the input. I've also found a workaround by adding type="search". None of them seems to work. Is material or angular overrinding this instructions? I'm using reactive forms! Any sugestions? Thanks in advance by your help 回答1: Chrome no longer supports