Posts by LeAndrade • 8,475 points
404 posts
-
0
votes2
answers3404
viewsA: What is the purpose of the third Addeventlistener parameter?
Just to complement with a practical and didactic example, the 3º method parameter addeventlistener is optional and receives a boolean value which in case is false (ou não conter os parâmetros)…
javascriptanswered LeAndrade 8,475 -
2
votes2
answers57
viewsA: Format string for (dd/mm)
You can use the method Slice() to do this in a very simple way, remembering that this can be done in various ways, such as the use of a regex for example: let date = '0608';…
-
2
votes1
answer50
viewsA: How do I put a class to work in front of a condition using ngclass
Your problem there is that the directive ngClass, doesn’t work that way as a ngIf for example, that a condition may be passed ternária, this directive works differently. For what you want to do,…
-
1
votes1
answer41
viewsA: Is there some kind of ALT property for a form field in HTML?
With Html I don’t know if this is possible, but, nothing prevents you create as in the example below that is with Javascript: let input = document.getElementById('entrada'); let span =…
-
1
votes1
answer118
viewsA: Inserting elements into an HTML list
The problem with your code is that by doing nomeDig.innerHTML = nomes vc is inserting the array into Html, rather than just another name. I gave a little improved in your code because it was very…
-
2
votes1
answer104
viewsA: How to fill a <li> tag created with Javascript?
I’m not sure I understand the question, but to do what you described setAttribute() would not help, therefore, it serves to set values to Html attributes as the method name itself demonstrates, in…
javascriptanswered LeAndrade 8,475 -
2
votes2
answers121
viewsA: Extract a string after a javascript delimiter?
You can do it using the method split(), which basically separates the string by an identifier, in this case the character - in a array then just take the part you want to use: var codigo =…
javascriptanswered LeAndrade 8,475 -
0
votes1
answer130
viewsA: Take the form-check-label input
First: you’re catching the value of label and not of input . According to: you are calling the Alert direct, thus value has not yet been captured, needing a function to display Alert only after the…
-
2
votes3
answers5868
viewsA: Compare values between Array’s Javascript
With the new Javascript templates, you can get the expected result using the method filter(): var jogo = [5, 15, 25, 35, 45, 55]; var sorteio = [9, 15, 16, 21, 35, 49]; var acertos = [];…
-
1
votes1
answer80
viewsA: Select select select value and open different links by clicking the button
Your code has some problems, you have to declare the if within the function, you have to take the property value of options, also has an extra key left in the code, and it is not much recommended to…
-
2
votes1
answer181
viewsA: Object array iteration with map returns Undefined
The mistake is very clear there Young man, You can’t read the property name of indefinido, pq: In his map() you’re already picking up the data from date [type]: result.data.map(rep => { ... And…
javascriptanswered LeAndrade 8,475 -
0
votes1
answer47
viewsA: Function is not being called in service - Angular
Your problem is that you are trying to perform the function footprint() who does the calculations in the file calculo.service in the archive limite.ts without referencing the function. To reference…
-
0
votes2
answers46
viewsA: delete jquery
I will leave an example of how it can be done, and there are several ways of doing this and I will show perhaps the easiest, now I advise to study before in Angular and see how it works, how it…
-
4
votes2
answers164
viewsQ: What would this . f be in Javascript?
Taking a look at a tutorial on Javascript I came across the following code snippet: let user = { name: "John" }; function sayHi() { console.log(`Hello ${this.name}`); } user.f = sayHi; // dúvida…
-
1
votes1
answer297
viewsA: Popular table at angle 8
This is common in Angular due to the data typing of Typescript, as in your code for example, when you make the following statement: (res.contasReceitasAbertas) You stated res but Typescript does not…
-
4
votes1
answer2537
viewsA: What it means: ERROR Error: Expressionchangedafterithasbeencheckeoverthrow
Although your question was not very clear, it would be good to take a look at the official documentation of Lifecycle Hooks of Angular, and in this material and this material here which I also think…
-
2
votes4
answers94
viewsA: How do I make the CSS class not affect anyone who has a particular class?
Just for the record, tbm can do whatever it wants with CSS attribute selectors: .navbar-solid { background-color: transparent !important; transition: background-color 1s ease 0s; } .navbar-solid img…
-
0
votes1
answer62
viewsA: Javascript-based async, promise, and await functions to control the time a popup is open
So Renan, it was not clear your question, because we do not know how is the function that checks the password input, but, to close the modal is very simple, if the password passes in the…
-
0
votes4
answers687
viewsA: Disable html element with jquery
You can do this with pure Javascript very easily even with the same structure HTML that you have. You can see in the example that when you execute the tag a will not have the attribute onclick, but…
-
2
votes3
answers120
viewsA: Problem with javascript filter in various JSON
So Victor, is returning empty, because this way you didn’t access the whole json tree to apply the filter: const products = categories.map((_categories) => { return _categories.products; // aqui…
-
2
votes4
answers171
viewsA: How to find a vector using a JAVASCRIPT function
A very good method to use is also the some(), with it through a callback function is returned the boolean value true if at least one of the elements in the array matches the condition. const skils =…
javascriptanswered LeAndrade 8,475 -
2
votes1
answer137
viewsA: Save data from Datetime in variable
You can take the value of datetime through a [(ngModel)] for example, then you will have the value of the type string in the format that datetime produces, which would be: 10:00, then you would have…
-
11
votes3
answers731
viewsQ: What is the advantage of using getters/setters in Javascript classes?
For example in this code below I use methods getters and setters in class: class Pessoa { constructor(nome) { this.nomePessoa = nome; } get _nomes() { return this.nomePessoa; } set _nomes(valor) {…
-
1
votes2
answers75
viewsA: Value does not enter in conditional
Probably you must be learning Javascript, so there are many errors in your Html how much in your js Html => div with id result without " " in the id attribute Js => document.getElementsByName…
javascriptanswered LeAndrade 8,475 -
5
votes2
answers3390
viewsA: How to apply Dynamic Mascara in angular input?
The ngx-Mask is working normally, it happens that if your phone contains space your length is counted with this space tbm, the correct is to leave the if greater or equal to 11 digits if the phone…
-
3
votes1
answer49
viewsA: Changing the image of a Section using javascript
You need to put the attribute url() and insert the link inside the image to render, but, what you want to do is not very nice, because depending on the image can take to load, the most indicated is…
-
1
votes2
answers302
viewsA: Counter reset every time reset
Hello Paul I made an example, but, I did not test. But the logic I implemented is very simple: 1. I put the day on the date in the form of string template to make it easier to manipulate the…
-
1
votes1
answer175
viewsA: How to transform a string into a float through the angular template?
I don’t quite understand your difficulty, but you can’t do the parse directly in Html, this does not exist, nor with interpolations Moustache {{}} can’t, parseFloat is a Javascript function and…
-
3
votes1
answer86
viewsA: How to concatenate a data + string when passing component property?
You can use the property title without doing the Property Binding by inserting in the title value the two variables in the form of interpolation - {{ }}: title="{{local.LocalCadastroData | date}} -…
-
1
votes2
answers166
viewsA: Ionic (Angular) - ngModel inside an ngFor
If it were me I’d do it differently, take the value of input with a function and model with that value taken from the function, you can see the example working here: HTML: <ion-input…
-
0
votes2
answers790
viewsA: How can I use a handlebar variable inside a script
I don’t know, I might be talking nonsense, but I think on the page admin/formulario in Html {{ state }} is a property of handlebars. To take the same status value and use it in Javascript just make…
-
1
votes1
answer102
viewsA: Show and hide toggle menu. Show function does not work. Can you help me?
I think you must have made some kind of mistake, the jQuery method toggle() toggles the visibility of the elements by itself, no need to pass parameters of Hide or show: $("#menu-1").hide();…
javascriptanswered LeAndrade 8,475 -
3
votes3
answers120
viewsA: Add an item to an array that is inside another array?
Only to supplement Taffarel’s response, if the secondary array have no fixed position in the main array you can do as in the example below not to have to do for example logDebug[1], making a for to…
javascriptanswered LeAndrade 8,475 -
1
votes1
answer109
viewsA: Return to the first tab when closing modal
You can use the Bootstrap event Hidden.bs.modal for when the modal is closed, set the class active for tab 1 with the method eq:() jQuery: $(function() { $(".btn-lg").click(function() { const…
-
2
votes1
answer250
viewsA: localStorage.getItem does not work
So Weslley, by the code you posted, you’re setting and taking the value on the same page and not setting the value on page 1 and taking page 2, the right one would be: Page 1 HTML - Página 1 <h1…
localstorageanswered LeAndrade 8,475 -
0
votes1
answer259
viewsA: Insert icone into a table
Passes a field fields in the date and inserts a chave and a label, and in the Html creates a slot within the b-table tagged i taking the date values: <template> <div class="col-6">…
-
1
votes2
answers104
viewsA: Translate date return and manipulate days
So boss, I’m not sure I understand your question, but I’ve formulated an answer here based on what I understand, you can see an example here: To translate the month, in the module, which can be the…
-
0
votes1
answer282
viewsA: Timer in Javascript
An implementation you can do is the following, create a variable to be incremented each 1 second with the method setInterval() from the click on the button and when the variable reaches the value…
-
0
votes2
answers139
viewsA: How to display/hide an element in Javascript
So, your Javascript it’s right the mistake there is your Css, as you are picking up an element by id, you don’t have to take anything else: function fAbreGuias() { var vGuias =…
-
0
votes2
answers256
viewsA: Close Load when opening modal
You can use the method setTimeout to give Hide in loading and show in modal: $(() => { $('.loading').hide(); $('.fa-search').on('click', () => { $('.loading').show(); setTimeout(() => {…
-
0
votes1
answer118
viewsA: Create new object without overwriting the old one in javascript
I found your question interesting and as you said you were studying I thought it would be worth leaving an answer. Your code presents several errors as already mentioned in the comments. I can’t say…
-
1
votes3
answers654
viewsA: Identify the value of a cell of the clicked line of an html table
Another way to get only the email: $("#modelTable > tbody").on('click', 'tr', function () { console.log($(this).text().split('\n')[2].trim()); }); #modelTable{ border-collapse: collapse; width:…
-
0
votes2
answers246
viewsA: Calling a method within a Javascript method
Just to register an example on the site, you need to use the this to reference the method and also concatenate to other texts. class Advogado { constructor(nomeAdv, tipoEnderecoAdv, ruaAdv, numAvd,…
-
0
votes3
answers212
viewsA: How to fill input data in BOOTSTRAP POPOVER
I’ll leave one more alternative, you can use the method content of function popover and use strings template to insert the fields into the content method, then just use expressions passing the…
-
4
votes1
answer45
viewsQ: What is the purpose of using a name for Javascript class expressions?
When using a class expression nominee in Javascript as in the example, I did not understand how to access _Name, whether it is possible to use it: let Nome = class _Nome { constructor(_nome) {…
-
4
votes2
answers456
viewsA: Fill text-area field while input information is entered
Just complementing Mark’s response ,the event onChange will only reflect the value entered in input when it receives the event of Blur, that is, lose focus, already with keyboard events like keyup,…
-
1
votes2
answers213
viewsA: condition in onclick
So, if I understood correctly what was missing there to validate the field and send the record was to call the function insert in the else, that is, if the field is valid: var myform =…
-
7
votes3
answers329
viewsA: How to return the number of arguments and sum the values of the arguments in a javascript function
You can use the argument and take its length, thus obtaining the amount of arguments passed in the function, in the example was used a Rest Parameters so that the function can receive an indefinite…
javascriptanswered LeAndrade 8,475 -
1
votes1
answer218
viewsA: Error picking up input from a <form> with Mongoose/nodejs
So it’s kind of hard to do a more appropriate analysis, but I think the problem there is that here in this piece of code: const newCategory = { nome: req.body.name, <= está utilizando o atributo…
-
2
votes1
answer227
viewsA: Problems in validating a Textarea
You don’t necessarily need to validate the textarea in the method validate, you can check if the textarea is empty in a normal function and thus prevent sending the form if the field is empty and…