components

Sending Variable from Component to Service in Angular 5

…衆ロ難τιáo~ 提交于 2021-02-20 03:49:37
问题 In my current Angular 5 project, I have been making successful API calls from my service (Code kept clean for brevity) myService.ts : @Injectable() export class my-service-service { constructor(private _http: HttpClient) { } myData1() { return this._http.get("API_URL") .map(result => result); } And accessing that information on my connected component by subscribing to the above service. myComponent.ts: import { myServiceService } from './my-service-service.service'; @Component({ ... })

Sending Variable from Component to Service in Angular 5

烂漫一生 提交于 2021-02-20 03:47:01
问题 In my current Angular 5 project, I have been making successful API calls from my service (Code kept clean for brevity) myService.ts : @Injectable() export class my-service-service { constructor(private _http: HttpClient) { } myData1() { return this._http.get("API_URL") .map(result => result); } And accessing that information on my connected component by subscribing to the above service. myComponent.ts: import { myServiceService } from './my-service-service.service'; @Component({ ... })

Is it possible to pass data after initializing the components?

北慕城南 提交于 2021-02-20 02:36:27
问题 I have three components as shown on the image below and use a custom form component in my feature component. However, there is not a direct parent-child relationship between these two components and there is also a form component between them. I pass data from feature to form using @Input propert that has input values inside a config data (let's say "configData") and then pass them to custom component via @Input property (let's say "configData.test" for test input) without any problem (I can

Is it possible to get minlength value from formcontrol?

女生的网名这么多〃 提交于 2021-02-19 01:34:04
问题 So i have my form validation. And my question is can i get for example a minlength value which i passed at creating formControl? I havent found any information. This is my dumb component and i want to get minlength value to pass to information. Now i need to pass it via @Input(). title: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(20)]] . <div class="validation-window"> <p *ngIf="errors.required"> {{field}} required </p> <p *ngIf="formControl.hasError('minlength')"

Is it possible to get minlength value from formcontrol?

走远了吗. 提交于 2021-02-19 01:33:29
问题 So i have my form validation. And my question is can i get for example a minlength value which i passed at creating formControl? I havent found any information. This is my dumb component and i want to get minlength value to pass to information. Now i need to pass it via @Input(). title: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(20)]] . <div class="validation-window"> <p *ngIf="errors.required"> {{field}} required </p> <p *ngIf="formControl.hasError('minlength')"

Is it possible to have two states in one react component

夙愿已清 提交于 2021-02-19 00:45:08
问题 I'm trying to build a simple unit convertor to practice React.js. I want to be able to change the value of one unit eg: Kg, and have the other unit eg: lb to automatically change on the screen. Please see this website to give you an idea: http://www.convertunits.com/from/lb/to/kg I have the following code, it renders but the units don't update. What I want to know is: Is it even accurate for one component to have two states ? 1 for Kg and another for lb Or would they need to be sibling

Is it possible to have two states in one react component

大憨熊 提交于 2021-02-19 00:44:55
问题 I'm trying to build a simple unit convertor to practice React.js. I want to be able to change the value of one unit eg: Kg, and have the other unit eg: lb to automatically change on the screen. Please see this website to give you an idea: http://www.convertunits.com/from/lb/to/kg I have the following code, it renders but the units don't update. What I want to know is: Is it even accurate for one component to have two states ? 1 for Kg and another for lb Or would they need to be sibling

Is it possible to have two states in one react component

故事扮演 提交于 2021-02-19 00:39:08
问题 I'm trying to build a simple unit convertor to practice React.js. I want to be able to change the value of one unit eg: Kg, and have the other unit eg: lb to automatically change on the screen. Please see this website to give you an idea: http://www.convertunits.com/from/lb/to/kg I have the following code, it renders but the units don't update. What I want to know is: Is it even accurate for one component to have two states ? 1 for Kg and another for lb Or would they need to be sibling

Component setSize method in FlowLayout object

混江龙づ霸主 提交于 2021-02-11 17:24:17
问题 I'm currently making a GUI that makes use of the FlowLayout class. Now, this class is meant to allow components be set by their prefer sized methods and I believe, isn't supposed to have priority in setting the component size. However, when I used a setSize method for a JTextField, the FlowLayout object didn't seem to recognize the change size command. But when I used the setColumn method, the FlowLayout object did respond to the change in size command. Why is this? 回答1: FlowLayout object

Angular 9 isssue with dynamic component load

Deadly 提交于 2021-02-11 16:56:56
问题 Dynamic components were loading absolutely fine in Angular 8. Once a component is loaded, Detach and Interest of components was also working fine. I am using ng-three-template. loadComponent(componentID: number, component: any) { this.viewContainerRef.detach(); if( this.componentFactory[componentID] == undefined ) { this.componentFactory[componentID] = this.componentFactoryResolver.resolveComponentFactory( component ); this.componentRef[componentID] = this.viewContainerRef.createComponent(