Posts by LuKs Sys • 1,658 points
53 posts
-
1
votes3
answers635
viewsA: Add data from array
Javascript has a function that solves your problem, it will add all the values and return you the final result const total = dados.reduce((a, b) => (a.preco * a.peso) + (b.preco * b.peso), 0);…
-
1
votes2
answers1000
viewsA: Git log command for all commits of a specific file
Try using the following command git log -p myFile
-
1
votes2
answers782
viewsA: Return of a Javascript function
Or if you prefer, you don’t need to call main() after the creation of the function. In time javascript the opportunity to create Self Invoking Functions, which are functions that auto-execute…
-
1
votes2
answers2148
viewsA: CORS JAVA (ERROR)
From what I understand probably you are creating an application made with Ionic and debugging the app by Chrome. If this is your scenario there is an alternative that easily solves your problem just…
-
3
votes5
answers12368
viewsA: Centralizing menu options in bootstrap 3
A very elegant way out to solve your question is to utilize the incredible power of flexbox. Below follows a basic example : nav ul { display: flex; width: 100%; } li { flex-grow: 1; } <nav>…
-
1
votes2
answers733
viewsA: How to call two animations in an element that uses ":Hover"?
I made an example to solve just what you need .hover-container { width: 100%; height: 120px; background: #191d20; display: inline-block; } .child1 { width: 20px; height: 80px; background: #197117;…
-
3
votes3
answers1044
viewsA: How to edit and load class only for a single element
This is because Forms are managed by the same property, so it is modified into one reflected in the other. So to solve this question in specific I separated the variables that manage the state of…
-
5
votes1
answer59
viewsA: Check if the person will close the site
This is the method called when the user tries to exit the page window.onbeforeunload = function(e) { return confirm("Você tem certeza que deseja fechar a página?"); };…
javascriptanswered LuKs Sys 1,658 -
2
votes2
answers109
viewsA: .onscroll is only read once
Try it this way: window.addEventListener('scroll', function(e) { if(document.documentElement.scrollTop>5){ menuPrincipal.style.backgroundColor = "rgba(0,0,0,1)"; }else{…
-
3
votes4
answers14684
viewsA: Javascript Regular Expression for Phone with IDD
The below regex valid the mask you need JS var RegExp = /\+\d{2}\s\(\d{2}\)\s\d{4,5}-?\d{4}/g; var t = "+99 (99) 99999-9999"; RegExp.test(t); //true var t2 = "+99 (99) 9999-9999"; RegExp.test(t2);…
-
1
votes4
answers2194
viewsA: How to block the click on an input
It is possible to do what you need only with CSS, this property ensures that the element will never be targeted by mouse events. CSS FILE #txtData { pointer-events: none; }…
-
0
votes1
answer129
viewsA: Deploy React on Heroku
Try these steps: heroku create -b https://github.com/mars/create-react-app-buildpack.git git add . git commit -m "react-create-app on Heroku" git push heroku master heroku open…
-
0
votes3
answers1274
viewsA: Can you place an array in a Javascript variable and compare it to the value in the text field?
You must transform the array into a string and then compare it with the value Substitute: var arr = new array("s10","s11","s12","s13"); For var arr = ['s10', 's11', 's12', 's13'].join(""); So…
-
0
votes1
answer608
viewsA: How to make a column layout responsive with js?
You can do this only with CSS: .grid_container{ width: 100%; column-count: 4; } .child{ display:block; min-height: 110px; width: 100%; -webkit-column-break-inside: avoid; -moz-column-break-inside:…
-
5
votes1
answer192
viewsQ: Bug when reordering React component list
I have a component that loads a list of components <ComponenteReordenavel> which is reordered according to the user’s taste. The bug happens when I modify the style of that component and…
-
26
votes3
answers10445
viewsQ: React Native or Ionic?
I need to create an App and would like to know which of your technologies is the most suitable for mobile development today. What is the main difference between Reactnative and Ionic? Which of the…
-
1
votes2
answers2167
viewsA: Pass data via POST in Angularjs to PHP API
For reasons that until today I do not know what they are, when the angular passes a post pro php you can not take the traditional way, try as follows: $data =…
-
2
votes2
answers170
viewsA: How to identify the end of the monitor with jquery
Use the bootstrap tooltip that he already worries about doing it for you. Header HTML <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">…
-
0
votes1
answer1678
viewsQ: onClick on dynamically created React components
I have a component user-defined called <Match> that is created dynamically within another component <Event>. But when putting onClick on the component an exception is popped. How to…
-
1
votes2
answers1896
viewsA: Loader on angled page
There is an angular plugin that does what you need. https://github.com/chieffancypants/angular-loading-bar This plugin will load the Loader every time a request is made, and while the request is…
-
3
votes4
answers6169
viewsA: Angular js Array within another array
Try to use one ng-repeat inside another: <div ng-repeat="item in array"> <div ng-repeat="object in item"> {{object.name}} </div> </div>
-
10
votes2
answers12658
views -
4
votes2
answers11378
viewsA: How to check duplicated elements in array?
With ES6 magic you can solve your problem with just one line of code. Ex: var a = ["Ceará","Eusébio","Ceará"]; var b = ["JavaScript",">","All"]; function hasDuplicates(array) { return (new…
-
2
votes2
answers1052
viewsA: How to set a timeout for a request?
Have you tried assigning the timeout in the Interceptor? angular.module('app') .factory('timeoutInterceptor', function ($rootScope, $q) { return { 'request': function(config) { url = config.url; if…
-
2
votes1
answer3545
viewsQ: Destroy React Component (Unmounting Component)
I would like to know how to destroy a component with React by clicking a button. I found a way out, but in my conception it is quite "gambiarrosa". I have a state called show and when click on close…
-
5
votes3
answers1743
viewsQ: Transform Number into binary text
How to achieve the representation of a Number (integer) in binary with Javascript? Ex: 47 = 00101111
-
9
votes7
answers2833
viewsA: How to check if at least one item of the array has value equal to or greater than 2
Try user the function of the array some Check if there is an element whose value is equal to 2 var x = [0, 0, 2, 0]; function isTwo(value) { return value === 2; } var y = x.some(isTwo);…
-
0
votes1
answer355
viewsQ: Test angular design compatibility in multiple browsers
I have a web application made with Angularjs v1.5.8 and I am worried about compatibility, but I do not intend to download several browsers and go out testing one by one in different versions. I want…
-
0
votes1
answer135
viewsA: I can’t set up remote GIT on the server
On the remote server create a folder for your project and another folder to store git mkdir myapp myapp.git Between cd myapp.git and start a Bare repository git init --bare Clone the repository to…
-
0
votes3
answers122
viewsA: timeout in Angularjs
Injects the $state to your Controller and after the video is finished use the $state.go. function goLogin(){ $state.go("app.login-new"); }
-
2
votes3
answers132
views -
0
votes1
answer190
viewsA: Error with angular intercerptors
Apparently everything is OK! Try to replace the Interceptor code with this Interceptor.js (function() { 'use strict'; angular .module('digApp') .factory('authInterceptor', authInterceptor);…
-
2
votes2
answers2979
views -
4
votes1
answer3439
viewsQ: Know how many times gitub project has been cloned
I have a small question to be resolved and I need to know if there is any way to identify how many times my project that is on github has been clonado.
-
0
votes2
answers70
viewsA: Angularjs HTTP 415
Try it this way: $http({ method: 'GET', url: 'https://minhaurl.com.br/api/v1/tasks', headers: { 'Content-Type' : 'application/json' } });…
-
1
votes3
answers907
viewsA: How to filter a Text in a div with JS angular
Use the angular filter itself HTML <div ng-app="myApp" ng-controller="myCtrl"> <label>Filtrar: <input ng-model="searchText"></label> <div ng-repeat="user in users |…
-
0
votes2
answers148
viewsA: Console error warning when running Ionic app
I already went through a similar error and at least in my case it was user permission problem. Try to run the following command: sudo chown -R meuusuario /usr/local/lib/ Then install Cordova and…
-
2
votes1
answer568
viewsA: How to set up an app to launch in Google play and Apple Store
There is no need to modify anything in package.json, the only file you should modify every time you generate a new version of the App is the config.xml, which is at the root of the project. Just…
-
3
votes3
answers2984
viewsA: Delete a specific row from an html table with jquery
Try it this way: $('[data-id="2"]').remove();
-
0
votes2
answers2611
viewsA: How to call an ajax inside another?
$.ajax({ url: 'MINHA_URL', type: 'post', data: { html: 'Teste 1' }, success: function(returnhtml) { $("#result").append($('</p>').html(returnhtml)); $.ajax({ url: 'MINHA_URL', type: 'post',…
-
2
votes2
answers981
viewsA: How to allow html tags to be executed from an angular variable?
Use ngBindHtml, in the example below the contents of the variable $scope.myHtml will be injected into the <div>. HTML <div ng-app="myApp" ng-controller="myCtrl"> <div…
-
2
votes2
answers700
viewsA: Call ajax inside another
Try running in sequence using $.when: $.when( $.ajax({ // Primeira a ser executada url: 'http://uma_url_qualquer.com', type: 'GET', success: function(data){ resultado1 = data; } }); $.ajax({ //…
-
0
votes2
answers87
viewsA: Div disabling jquery find next element
From what I could tell from your code, the second example https://jsfiddle.net/667qorya/ the <select> is not inside the <div class=".caixa-dependentes2"> so when you try to call the…
-
0
votes2
answers1057
viewsA: Angular route link does not work on bootstrap
To work the way you are implementing now just replace the ng-href for href. <li><a href="#/principal">Início</a></li> <li><a…
-
0
votes2
answers146
views -
1
votes2
answers228
viewsA: Replace all characters with "_" except the 1° character of each word
The following logic will solve your problem: var text = "QUOTE"; function replaceString(text){ var textRefact; for(var i = 0; i < text.length; i++){ if(i == 0){ textRefact = text.charAt(i);…
javascriptanswered LuKs Sys 1,658 -
2
votes1
answer132
viewsA: Recover bigger facebook image by ID
Use the following service: https://graph.facebook.com/v2.5/{{id}}/picture?type=large
-
0
votes5
answers2039
viewsA: How to centralize information for all Tds by CSS?
The most external to you should put the property text-align:center; , and put it on the property margin:auto; HTML <div class="container"> <td>Alinhado</td> </div> CSS…
-
6
votes3
answers4045
viewsA: How to add <li> dynamically in <ul> with jQuery?
Use the property . appendTo $('<li />', {html: "Meu texto", href: "/tasks/detail/"}).appendTo('ul.dropdown-menu') Any doubt follow the example : https://jsfiddle.net/lucassilvax/fxmngLwd/…
-
0
votes1
answer48
viewsA: Session does not work between functions
<?php session_start(); Try using session_start on the first line of your php file.