Posts by Leandro Oriente • 476 points
20 posts
-
0
votes1
answer631
viewsA: Differences between $('body'). on('click',...) and $('selector'). click()
The basic difference between the two is who you link the event to click. In the first case it will capture the event when it arrives at the body and originate from the desired selector. As…
-
0
votes2
answers362
viewsA: How to pass content from JSON Object to a controller - Part 2 - Using Parse.Query
The Parsereturns a promise. The first step is to return this promisein the call of that function. If you do not give a return in it, the promise is lost within the function. To hit this just change…
angularjsanswered Leandro Oriente 476 -
0
votes4
answers8807
viewsA: How to insert a property into a javascript object?
To add a new property to a javascript object just use the following syntax: var data2 = { "desColigada": "Empresa fulano de tal", "codMatricula": "00555454", "dataImpressao": "23/05/2016" };…
-
1
votes1
answer43
viewsA: pq the input x iteration DOES NOT interfere with the while loop x iteration, where it is the same variable?
What happens is that when you do any operation with a variable, it does not change value. x = 1 x + 1 // 2 print(x) // 1 To change the value of a variable you need to assign a new value to it. x = 1…
-
4
votes2
answers421
viewsA: Javascript variable value assignment
You probably have an asynchronous problem. Everything that happens inside the $.ajax exits the default javascript execution queue and runs asynchronously. That is, when you try to access the…
-
1
votes1
answer102
viewsA: Confusing code - what does it mean?
This looks like a template language. It might be Handlebars. Basically the double keys tell the interpreter that it is a tag and that it needs to be replaced by a valid HTML content. There in case…
-
1
votes2
answers599
viewsA: Dynamic imports in Javascript
You can’t create imports dynamics. As you commented, the import javascript is static, so it does not accept interpolation of strings. What you can do is use the require. require ('../../Clientes/'+…
-
0
votes2
answers142
viewsA: How can I separate this javascript string into two php variables?
You will only get through this data via Ajax. When PHP renders the page it literally writes that $teste = "<script>getLocation()</script>";. For him…
-
2
votes2
answers192
viewsQ: How to define conditional properties for a literal object in the leanest way possible with Javascript?
I would like to know how to add conditional properties to a literal object in the leanest way possible. I currently declare the object and then add the conditional properties as in the following…
-
0
votes3
answers1170
viewsA: How do I share posts from my website on facebook?
You can use the facebook SDK. Just load the SDK: <!-- Load Facebook SDK for JavaScript --> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs =…
-
4
votes3
answers6724
viewsA: How to use Ellipsis css3?
To break in the first row you need to add the following properties as well: { white-space: nowrap; overflow: hidden; } Otherwise your text will break down to the bottom line and continue endlessly.…
-
0
votes1
answer267
viewsA: How to pass JSON Object content to a controller
You have some problems in this function. If you use $http, that you inject but do not use, you will have asynchronous problems, but let’s focus on the current problem. You are using a method of your…
angularjsanswered Leandro Oriente 476 -
2
votes1
answer533
viewsA: Create variable with other variable content
It is not a very common practice. The goal of defining a variable is to be able to use its content later. If you create this variable dynamically, you will need to access your content dynamically as…
-
5
votes2
answers582
viewsA: How to minify project in Angularjs?
As answered earlier, the build process renames the function statements, but preserves the array with the name that should match the dependency injection. I’m not sure how you’re doing the…
-
2
votes2
answers146
viewsA: A notification system using setInterval + AJAX is bad?
If the setInterval is too short (milliseconds) you start to run the risk of having inconsistencies. Requests can start arriving in orders other than those that were executed and this can result in…
-
1
votes1
answer61
viewsA: Sorting PHP Array
I don’t program in PHP but I made a super simple algorithm that solves the problem with javascript. Basically it checks which is the longest array and does a go over the maximum size. At each pass…
-
1
votes3
answers853
viewsA: Nodejs Forever Not for
The forever has a command that kills all currently active sessions. Just run forever stopall. After that just start the correct process. Reference: https://github.com/foreverjs/forever#Usage You can…
-
2
votes1
answer192
viewsA: Bug when reordering React component list
Two problems that may be responsible for the bug. You’re using the index as key. React uses the key to perform its updating algorithm DOM as efficiently as possible. If you change a position…
-
1
votes1
answer812
viewsA: Failed propType: Invalid prop `Children` supplied to`Router`
Two problems I noticed in the Component Header You perform the import of Header of react-mdl as HeaderMDL import { Header as HeaderMDL, Drawer, Navigation } from 'react-mdl'; After that you define…
-
1
votes2
answers229
viewsA: Check data according to the ready information
I recommend that you do not authenticate in this way. Never expose user authentication data. Anyway, to check if a given object is part of an array just iterate over it and check field by field. Ex:…