Posts by LeAndrade • 8,475 points
404 posts
-
2
votes1
answer171
viewsA: Regex angular ngModel
You don’t need regular expression to do this validation, you can take the first value of input with the method replace() and check if it is a number with the method isNaN(): TS…
-
0
votes1
answer37
viewsA: Formgroup.Valid starting as true IOINIC V3
You can solve this problem in a very easy way by entering the attribute required in the input, you can see the example working here: <form [formGroup]="formGroup"> <ion-item>…
-
0
votes0
answers51
viewsQ: Problem installing flash package from express via npm
I’m having trouble installing middleware packages flash express. I can’t install any of the packages, either flash, connect-flash or express-flash present the following error at the prompt: Someone…
-
2
votes2
answers145
viewsQ: Return certain array values
Consume an Api whose return is an array with 10 objects inside, I want to show on the screen only the first five of the array, which are always the latest in the Api, as you can see in the code…
javascriptasked LeAndrade 8,475 -
4
votes1
answer98
viewsA: Pass an indeterminate value of an input to Javascript
Then for you to get the values by input, just get the elements through a id for example and so take your values, failed to declare tbm the variable nota_4. I believe you are learning Javascript, a…
-
0
votes2
answers207
viewsA: How to check whether an image has been clicked or not
Only one of the many ways that can be done basically changes the image according to the counter’s condition: let count = 0; document.getElementById('imagem').addEventListener('click', function() {…
-
5
votes3
answers903
viewsA: How to assign Fetch value to a variable
I don’t know if I understood your question correctly, but the return is an object, with several other objects inside, so in the variable dia_do_mes doesn’t need the {}, just assign the value of r a…
javascriptanswered LeAndrade 8,475 -
2
votes1
answer196
viewsA: Force selection on ng-required combo
There are some errors in your code: To validate fields with the Angularjs they must be within an element form with an attribute name obligatory In this case there is no mandatory use of the…
-
1
votes1
answer802
viewsA: Pseudoclass :not() does not work with combinator
This result was because you reversed the order, if you want the p without the styles then it is the same that should receive the not(), can read more about this pseudo-classe here: article…
-
3
votes2
answers75
viewsA: text superimposing the before
I don’t really know if there’s a way the way you want to do it, may be that someone later from another better answer, but, if I understood correctly if what you want is to insert the image before…
-
2
votes1
answer243
viewsA: Angular 7 - mat-table with complex Json
It’s not your complex Json, as you are working with Angular, Json are very common so you have to know them well to access their properties, you can see the example working with your data here. In…
-
1
votes3
answers776
viewsA: Use of length to count concatenated strings
Aside from what Artsher Developer exemplified in his answer, the Return mode he did returns only the first element found, that is, the name. For you to print also the full name for example, can…
-
1
votes1
answer259
viewsA: angular - How to replace setInterval?
You can change the setInterval() of Vanilla by Observable.timer with Angular, simply import the libs necessary and use it, can see an example working here, in the example is used tbm the method…
-
8
votes1
answer691
views -
1
votes1
answer453
viewsA: How to put maximum value in a Date field in Angular 7?
So it seems to be a bug in the Html this problem with inputs like date, I made an example below that can help you there in the case, basically I take the value of the input and when the value is the…
-
0
votes2
answers209
viewsA: $. each on a JSON of cities
You can do as in the example below, using the method change() and thus go through the arrays city that give match with the select of states: let dados = [{ "sigla": "AC", "nome": "Acre", "cidades":…
-
3
votes2
answers68
viewsA: Get only first item from a sublist Vuejs
The point is what you’re doing v-for the more, when it does v-for="conteudos in conteudo" from there you already have everything you need in countenances: new Vue({ el: "#teste", data: { conteudo:…
-
6
votes3
answers1319
viewsA: How to create a list from a JSON with Javascript?
Maybe the way I did it is not the most performative mode, but here I leave an example of how it can be done using Javascript methods like filter(), for in and Object.(): const dados = {"animais":[ {…
javascriptanswered LeAndrade 8,475 -
1
votes1
answer828
viewsA: DDD + CSS phone
I don’t understand what your difficulty was, but just do as you are at documentation and put the size you want the input into the classes of grid: <link rel="stylesheet"…
-
1
votes2
answers87
viewsA: Change ngModel connection
Costamilam’s response is excellent, but it changes the type of data object for object array, if you want to keep the original data type, I leave another example (that can be seen here) how it can be…
-
2
votes1
answer65
viewsA: How to drop drag anywhere in the container
I made an example being an alternative to your case that might help, not being the most functional way of achieving, because as you can see in the code I setei the specific positions where the…
javascriptanswered LeAndrade 8,475 -
1
votes1
answer58
viewsA: I upgraded Angular 5 to 8 - Conflicts
In the Angular V8 some packages had their functionalities changed for a better performance and so changed name, for example: The Module Httpmodule was replaced by Httpclientmodule being imported…
-
3
votes1
answer746
viewsA: How to limit an input of type Number to only 3 characters by Angular 7?
Is developing with Angular should already know how to transpose a code Vanila for Typescript, I made an example here for you that can be tested in stackblitz: TS: somenteNumeros(e: any) { let…
-
1
votes3
answers484
viewsA: Display only the first 3 elements of a list (Javascript, jQuery)
Can traverse the li through the method each() and give a Hide() in others: $(() => { $("li").each(function(index) { console.log(index + ": " + $(this).text()); if(index > 2) { $(this).hide();…
-
1
votes1
answer737
viewsA: How to clear the field at Angular?
You’re using the same model -> [(ngModel)]="filtroDevedor.cpfCnpj" for both of us input, so when you type something into the CPF this is stored in the model and when it changes in select to CNPJ…
-
7
votes2
answers318
viewsA: Sum values from different JSON indices
You can do whatever you want using the methods map() and reduce() as follows: let retorno = [ { "itemIndex": 0, "selectedSla": "Expressa", "selectedDeliveryChannel": "delivery", "slas": [ { "name":…
-
1
votes1
answer27
viewsA: Instantania Check Box
Just change the event of keyup for onchange: var cliente = document.getElementById('nome'); var cliente1 = document.getElementsByClassName('cliente')[0]; function insere() { cliente1.innerHTML =…
-
1
votes1
answer421
viewsA: Consuming MARVEL API with Angular 8
Step 1: You need to create the account thus generating a chave pública and a chave privada on the Marvel website. Step 2: After having the keys you need to create the hash, as? Catch the timestamp +…
-
3
votes2
answers94
viewsA: How to erase the symbols of a CPF in an input?
You can add other cases by cutting the string at the position where the characters are, I used in the example the method replace(): var box = window.document.querySelector("#box");…
javascriptanswered LeAndrade 8,475 -
1
votes1
answer574
viewsA: Component does not render in Angular
When you create a component with Angular you can automatically use it where you need it, to render the new component in another it is necessary to declare it in the component by your selector: Your…
-
5
votes3
answers72494
viewsA: How can I check if one string contains another in Javascript?
It is also possible to find string inside another through the method includes(): let string = 'Meu texto aqui'; let result = string.includes('texto'); console.log(result); This is very useful if…
-
0
votes2
answers47
viewsA: How to pick up a word that contains a specific character?
One of the ways to do this is by using the method filter() along with the method includes() to see if the string contains the , and return that part of the string: let string = 'Sofá 3 Lugares…
-
1
votes1
answer59
viewsQ: How do I leave the background of a Hover color input in a table?
Is there any way to let an input that by default has its white background-color stick to the color of the line at the time of Hover? input { border: none; outline: none } <link rel="stylesheet"…
-
0
votes1
answer332
viewsA: How to add an input value to an existing value? Vue
Nice that you’re learning, then, Vue has in one of its premises the simplification of the Javascript. You can and indeed even "should" declare everything you use within the Vue and not do as you…
-
1
votes1
answer54
viewsA: Change box text when selecting option
To get the selected value of a option in a select with Javascript there are many ways, one of them is using selectedIndex select being listened to by an event usually the onchange: let…
-
0
votes3
answers66
viewsA: How to run a search on an array until a condition is met?
Another alternative is that you can instead use a for simple, use a more advanced method such as filter, that returns a Boolean as the return of a condition tested by it: public nomesCadastrados =…
-
1
votes2
answers159
viewsA: How to access a variable within ngAfterViewInit() in Angular
This issue independent of Typescript is what is called the scope being the basic of Javascript. You cannot access variables or their values declared outside the scope where they were created. Note…
-
2
votes3
answers356
viewsA: insert into the dictionary
A way to do: var dict = {}; dict['chave'] = "valor"; console.log(dict);…
-
1
votes2
answers352
viewsA: Taking an element inside an object
Nice that you are learning Javascript, so for you to access elements within an array you have to indicate your index, that is, in the case how all the return of the API is within 1 array you can…
-
0
votes3
answers597
viewsA: Summing up JSON values
Luiz’s answer already meets your question, I’ll just leave another example of how it can be done using reduce: const dados = { success: [ { cod: "158877", txt: "158877", fields: { Valor: "22,33",…
-
2
votes1
answer128
viewsA: Image bootstrap tooltip does not work
What was missing there was to insert the data-html="true" to render title content as HTML: $(function() { $('a[data-toggle="tooltip"]').tooltip({ animated: 'fade', placement: 'right', html: true });…
-
1
votes1
answer233
viewsA: Carousel materialize does not work
So, as you can see in the example below, it works perfectly. The problem: you simply copied the documentation code, and the documentation is to demonstrate how things are done and what you can do.…
-
3
votes3
answers146
viewsA: write json sentences html
I made an example with the data mocked and as you can see it worked, of course I had to change the [1] for [0] otherwise it would not work tbm. Probably your problem is in the request Ajax. To make…
-
1
votes1
answer98
viewsA: Grab a link id and create div on another page
First - your code is very messy, it’s mixing jQuery with Javascript, but, we can create the div video in that way: $(function() { const o_v = $('#o-v'); o_v.on('click', function() { var video =…
javascriptanswered LeAndrade 8,475 -
1
votes1
answer198
viewsA: function to remove item(any list) does not work in Vuejs
For this just change the method Slice by the method splice. The Slice method generates another array, exactly with the result of the cuts, that is, it would return the resultados excluídos da lista.…
-
1
votes1
answer1116
viewsA: Making sum with angular
Nice that you’re learning, so there’s a lot of syntax errors in your code HTML as in your TS. For you to pick up an input value in a much used way (but she’s not the only one) is with the directive…
-
1
votes4
answers553
viewsA: Get values from a multiple select (Materialize)
First you have to remove the attribute Selected at first option then create a array to save the selected options, as in the example below: $(function() { $("select").material_select();…
-
0
votes3
answers98
viewsA: How to select a specific ul with jquery
A very practical way to do this is by using the selector :eq(), with it you do not get stuck to the first element, can put any number there, leaving the code much more flexible, even to be used with…
-
1
votes1
answer84
viewsA: Active list for other in Javascript
You can do this with the example below: var eassociado = document.getElementById('eassociado'); var chkveg = document.getElementById('chkveg'); chkveg.style.display = 'none';…
-
0
votes2
answers803
viewsA: Accordion Bootstrap 4
Well, for you to decrease the size of the spacing card-header, you can decrease by the element h5 decreasing the margin and setting the flag Important to overwrite the Bootstrap Css, and remove the…