[Solved] How to append children to object dynamically

The most easy way is pass as argument the index of “terms”. Put two buttons, one to AddTerms and another one to hideTerms/showTerms. <div *ngFor = “let term of terms;let i=index”> <!–see the way to get the index of the array –> <div class=”row tr”> {{term.id}} <!–you make a link, I use a button–> <!–the … Read more

[Solved] Angular 2+, why doesn’t material want to show error message?

*Update To create a customFormControl over a control, we use parent, see an example checkPasswords(): ValidatorFn { //see that the argument is a FormControl return (control: FormControl): ValidationErrors => { //the formGroup is control.parent const group = control.parent as FormGroup; //but we must sure that is defined if (!group) return null; console.log(group.get(“password”).value); let pass = … Read more

[Solved] How do I make a button stay “Pressed” after clicking

my sulotion (need to use a Directive) –html button.component.html <button class=”btn btn-danger” style=”width: 110px” appButton” ></button> –Typescript button.directive.ts @Directive({ selector: ‘[appButton]’ }) export class ButtonDirective implements OnInit { constructor(private elRef: ElementRef, private renderer: Renderer2) { } ngOnInit() { } @HostListener(‘mousedown’) onmousedown(eventData: Event) { if (this.elRef.nativeElement.style.backgroundColor === ‘blue’) { this.renderer.setStyle(this.elRef.nativeElement, ‘background-color’, ‘rgba(200,0,0,0.7)’); } else { this.renderer.setStyle(this.elRef.nativeElement, … Read more

[Solved] how to auto add two decimal places to the input field in angular 4

So what you basically need is masking your input. angular2-text-mask provides you a directive which you can use on your input elements like this: <input [textMask]=”{mask: amountMask}”> Where amountMask is a property declared your component: public amountMask= createNumberMask({ prefix: ”, allowDecimal: true, decimalLimit: 2 }); To install angular2-text-mask package: npm i angular2-text-mask –save createNumberMask is … Read more

[Solved] can’t understand Angular 2

Without any additional information, it looks like you haven’t given the component’s metadata a selector. The selector identifies a matching HTML element in the app’s index.html file to insert the component’s HTML. An example: index.html <!doctype html> <html> <head> <meta charset=”utf-8″> <title>My App</title> <base href=”https://stackoverflow.com/”> <meta name=”viewport” content=”width=device-width, initial-scale=1″> <link rel=”icon” type=”image/x-icon” href=”favicon.ico”> </head> <body> … Read more

[Solved] downsides of using Ivy in Angular?

Bundle sizes may be larger than without Ivy and strict template type checking may give you some problems. Those issues should be resolved in 9.0.0 final. The RC is coming soon and is worth testing out. -Michael Prentice (Angular Team) Please look at the comments below from Michael himself 🙂 3 solved downsides of using … Read more

[Solved] Converting from angular I to Angular 2 [closed]

I know it’s been a downvoted question but I would still like to provide you an answer. For the above html, you can create something similar in angular 2 as: app.component.ts import { Component } from ‘@angular/core’; import { NgForm } from ‘@angular/forms’; @Component({ selector: ‘app-root’, templateUrl: ‘./app.component.html’, styleUrls: [‘./app.component.css’] }) export class AppComponent { … Read more