Posts by Bruno Cunha • 292 points
16 posts
-
0
votes1
answer18
viewsA: How to set the value of a dropdown (primeNg) taking only one property of the object
You can format the object in the format that primeNG expects {label, value}. Being the label indicating the name that will appear in the field, and value the return value. this.templates_pdf = [ {…
-
1
votes2
answers72
viewsA: How to filter an array with Timestamp elements?
You can take the date you want to compare and convert it also to timestamp using the function new Date().getTime(). For example, say I only want dates before December 1, 2020. const FilteredValue =…
-
-1
votes1
answer43
viewsA: How to use a form in the sister component?
1. Using @Input() If you have direct access to the child component, you can pass the form through the @Input property() <!-- app-pai.component.html --> <app-pai> <app-filho…
-
0
votes2
answers47
viewsA: How to fill two formArraym one inside the other
In your case you want to create an array of objects, where each object has an attribute called dependentes this being another array. So in creating the form, if you want to already initial a plan…
-
1
votes3
answers45
viewsA: I can’t get the "id" parameter of the URL in Angular 12 using Activatedroute?
When you use "subscribe", this function will usually only be triggered when there is some route change. To capture the parameter as soon as the component starts, use the snapshot. ngOnInit(): void {…
-
0
votes2
answers89
viewsA: How to call a function within itself? Recursiveness
Hello! For you to perform a function with recursiveness just call it again inside the SAVE() function without the word Function in front, because Function serves for you to declare a function.…
-
1
votes1
answer40
viewsA: Changing strings of an object in a foreach
From what I understand you want to mount a dynamic object with attributes that are marked with checked: true in your itemsList. Your end result is getting "Neighborhood: Row.neighborhood" as you are…
-
0
votes1
answer237
viewsA: How to save checkbox status within an angular dropdown?
Hello! You can use [(ngModel)] to update the view and its variables automatically; <input type="checkbox" [(ngModel)]="item.checked"> I made an example on stackblits for you to see:…
-
0
votes1
answer56
viewsA: Search by ngFor date range
Hello! In your case, I would only create a function in the component itself that filters your array, to avoid running the pipe code several times. filtrarItens(arrayOriginal, startDate, endDate) {…
-
2
votes2
answers62
viewsA: Separate and print Object items in HTML
Hello! The answer to your request is an object with the attribute items, this being an array. For you to print all the items, you would need to iterate on it, going through each item in the list and…
-
1
votes3
answers125
viewsA: Check whether an item exists within an array, using a variable
Hello! If you try to access the attribute this way checkOne[0].attributes.tipo, you are trying to access the type variable within the attributes, and will always give false. If you need to access an…
-
1
votes1
answer29
viewsA: How to remove special character from the class obtained from a text?
You can normalize the string using an ES6 javascript function. const textoNormalizado = el.text().normalize('NFD').replace(/[\u0300-\u036f]/g, '');…
-
0
votes1
answer30
viewsA: I’m making a calculator and I can’t display the results
Hello! You need to update the page element with the result found. For this, you need to capture this element (it can be by id) and set value. In addition the comparisons in IF need 2 equal signals.…
-
3
votes2
answers56
viewsA: Javascript Comparators - [help]
I saw some points in your code that would need to be reviewed. First, in the third if, you put only one equal sign, in which case you are assigning the value of element2 to element1, rather than…
javascriptanswered Bruno Cunha 292 -
1
votes2
answers423
viewsA: How to make a [GET] request with custom headers in Angular 10?
Hello! Often when CORS error happens it is triggered by backend. You would need to add Access-Cross-Origin in the backend. If you are using nodejs with express, there is a simple package to free up…
-
0
votes2
answers162
viewsA: Select does not load the options using Angular
Hello! Apparently its state return is already an array, so if you do "states.push(reply)" you are inserting an array within an array. Therefore, just attributes your variable of states to answer.…
angularanswered Bruno Cunha 292