Angular 4 – get input value
<form (submit)=”onSubmit()”> <input [(ngModel)]=”playerName”> </form> let playerName: string; onSubmit() { return this.playerName; }
<form (submit)=”onSubmit()”> <input [(ngModel)]=”playerName”> </form> let playerName: string; onSubmit() { return this.playerName; }
Change ng-disabled=”!contractTypeValid” to [disabled]=”!contractTypeValid”
Since your condition is falsy and so doesn’t return the second argument (<GeneralLoader />), it will return profileTypesLoading, which is a number, so react will render it because React skips rendering for anything that is typeof boolean or undefined and will render anything that is typeof string or number: To make it safe, you can … Read more
After some research and modifying my code as below, the script worked for me. I just added the condition: this.router.navigateByUrl(‘/RefreshComponent’, { skipLocationChange: true }).then(() => { this.router.navigate([‘Your actualComponent’]); });
Yes. Try: class USBDevice : GenericDevice, IOurDevice Note: The base class should come before the list of interface names. Of course, you’ll still need to implement all the members that the interfaces define. However, if the base class contains a member that matches an interface member, the base class member can work as the implementation … Read more
Run change detection explicitly after the change: import { ChangeDetectorRef } from ‘@angular/core’; constructor(private cdRef:ChangeDetectorRef) {} ngAfterViewChecked() { console.log( “! changement de la date du composant !” ); this.dateNow = new Date(); this.cdRef.detectChanges(); }
Updated: 19/03/2017 this.form.controls[‘dept’].setValue(selected.id); OLD: For now we are forced to do a type cast: (<Control>this.form.controls[‘dept’]).updateValue(selected.id) Not very elegant I agree. Hope this gets improved in future versions.
It should be noted that it is an anti-pattern to copy properties that never change to the state (just access .props directly in that case). If you have a state variable that will change eventually but starts with a value from .props, you don’t even need a constructor call – these local variables are initialized … Read more
Components control views (html). They also communicate with other components and services to bring functionality to your app. Modules consist of one or more components. They do not control any html. Your modules declare which components can be used by components belonging to other modules, which classes will be injected by the dependency injector and … Read more
what benefits does OSGi’s component system provide you? Well, Here is quite a list: Reduced Complexity – Developing with OSGi technology means developing bundles: the OSGi components. Bundles are modules. They hide their internals from other bundles and communicate through well defined services. Hiding internals means more freedom to change later. This not only reduces … Read more