Skip to content
Advertisement

Tag: angular

How to use ngIf condition with a constant and a ngModel

I have the following html file. The above is obviously incorrect. What is the correct syntax for my ngIf directive if I want to compare {{selectedMetric}} and a string constant like “option 1″? Answer <div *ngIf=”selectedMetric===’Metric 1′”>Selected first </div> should to the trick to compare a variable against a literal string

(change) vs (ngModelChange) in angular

Angular 1 does not accept onchange() event, it’s only accepts ng-change() event. Angular 2, on the other hand, accepts both (change) and (ngModelChange) events, which both seems to be doing the same thing. What’s the difference? which one is best for performance? ngModelChange: vs change: Answer (change) event bound to classical input change event. https://developer.mozilla.org/en-US/docs/Web/Events/change You can use (change) event

@Input() issues

I’m trying to get data from a variable from another component, but so far it hasn’t been working. The idea is that when I check a checkbox, the variables (Booleans) become true and some things on my page are visible and vice versa. So basically I want the variables from InstellingenComponent to work in AfdelingDetailComponent. With @Input() it’s not working…

Angular – How do directives “see” template & ViewContainer?

I have a simple component which injects numbers after a delay via custom directive named *appDelay I already know that * is a hint for Angular to de-sugar the syntax into something like I also know that we can Inject components/templates to the viewContainer via : The directive code is : The docs states : To access a ViewContainerRef of

How to ‘wait’ for two observables in RxJS

In my app i have something like: Then i get two separated results, first of the _personService and then the _documentService. How can I wait for both results before call this.showForm() to finish an then manipulate the results of each one. Answer Last Update: Mar, 2022. RxJS v7: combineLatestWith From reactiveX documentation: Whenever any input Observable emits a value, it

Advertisement