Posts by MoshMage • 1,789 points
81 posts
-
0
votes2
answers110
viewsA: Is it possible to use Async Generators with the ES5 syntax?
Is it possible? Is it. Is it feasible? No. Basically, you have to create you a function that is the awaiter and another one that is the Generator and then flames one inside the other with the final…
-
2
votes1
answer106
viewsA: Spinner Angular material does not work in synchronous calls
As you were told in the comments, your code is synchronous - that is to say: it will not wait for nothing to end, it will simply run the script statements until its end. to be asyncrono (which is…
-
0
votes1
answer125
viewsA: Multiple image upload with Fetch API
In fact, const files = document.querySelector('.selecao_arquivo') this constant nay is an array, although it is of the Iterable type, this constant is actually an FileList. So, files[i] does not…
-
1
votes3
answers50
viewsA: How to declare a function that has calls with quantities of different parameters?
The job declaration stays the same, which you have to worry about is if that element exists; function inputPlaceFocus(input, ph, eye){ if (input.value.length == 0) { ph.style.transform =…
-
0
votes1
answer76
viewsA: How to check if there is an input of an array within another to avoid duplicating?
So if you notice, you already do that: const title = this.books[i].volumeInfo.title this line will fail if index i in the array this.books not existing with "cannot get . volumeInfo of Undefined"…
-
0
votes1
answer72
viewsA: Auto onclick in function
This is because on this line: $('#' + convertNameToId(name) + '-botao-plano').attr('onClick', abrirPlano(result[i].pla_id, month, year)); you are expressly saying that the attribute "onclick" has…
javascriptanswered MoshMage 1,789 -
0
votes2
answers53
viewsA: Scope of Literal Objects - Javascript
this happens because obj was declared within window, that is to say: obj = {}; is the same as window.obj = {}; however, your showContext was delcarado with a statement Function, then he wins the…
javascriptanswered MoshMage 1,789 -
7
votes1
answer464
viewsA: How to securely pass token after authentication to angular application
The most common is what you have done: Record the token in Session-Torage and then access Session-Storage when you want to read it. This is as safe as "saving a file to your pc", and only the client…
-
0
votes2
answers376
viewsA: Filter with Typescript
Divide this into "Trials": - First, find the elements that have the code you want - Second, when iterating under the found ones filtered, then send it to a new array - at the end shows the result of…
-
1
votes1
answer98
viewsA: Google Places API - Search with multiple Keywords using google Places api with javascript
According to the Issue tracker it seems that it is commas instead of Pipes However, after hitting 50x against an "invalid query" I found that if... you change keyword for keywords (plural) this…
-
0
votes3
answers6815
viewsA: Eslint captured an error, Parsing error: Unexpected token =
It seems to me that you are trying to use an "Arrow Function Expression", these should be made attached to a Scope, Pex: const functionName = () => console.log('hello from functionName'); These…
-
0
votes2
answers619
viewsA: It is possible to return a Observable<Boolean> from the get request
What’s going on here is that you’re trying to take a value from a "Cold Observable" this happens when you do not subscribe to an event (in this case, the event that is returned from http.get(). This…
-
1
votes2
answers647
viewsA: Catch only days of the month by removing Saturday and Sunday with JAVASCRIPT/TYPESCRIPT
Without the Moment-js, why... put an entire lib just for this until the C: function getWeekDaysInMonth(month = 0, year = 2018) { console.log('Weekdays for', new Date(year, month, 1).toString())…
-
0
votes1
answer582
viewsA: Angular Typescript input change Event
You will have to point directly at the formControl inside the formGroup (Pex formGroup.OriginalMonthlyValue) and then do setValue() in that form-control. Since you are not using ngModel, the…
-
0
votes3
answers4107
viewsA: How to implement Bootstrap 4 in Angular CLI
Okay. The problem here is you forgot to add the css to your themese :D in your main.scss (or equivalent) you only have to import the scss from the bootstrap: // main.scss // 3rd party libraries…
-
1
votes1
answer325
viewsA: print Eventemitter data at angular 2
In the ngOnInit of your app.component.ts you’ll have to do the same thing you did with the this.authService.authNav ngOnInit(){ this.authService.userData.subscribe(data => this.userData = data);…
-
2
votes1
answer639
viewsA: Group data with Ngfor and Groupby
The filters of Angularjs did not pass to Angular2 and do not exist (many) pipes that exist by default. So first you have to do the @Pipe() "group_by" and then yes, you can use it. Yet you can always…
-
0
votes3
answers104
viewsA: How can I simplify access to the values of interest of a JSON in Javascript?
It’s a bit far-fetched, but you can do a recursive function that looks for the object’s Ntries and if the first return key is equal to the key you’re looking for, then return that value - otherwise…
-
0
votes2
answers429
viewsA: Create dynamic variables in Javascript
You can. However you have to remember that all variables without context, that is all variables that are not declared in an object, are of the context window; So, var a = 1; is the same as window.a…
-
2
votes2
answers2414
viewsA: Pure Javascript add class function [can’t be left 2015/2016]
You can use the methods of classList Element.classList.toggle('nome-da-class') Element.classList.add('nome-da-class') Element.classList.remove('nome-da-class') Applying this to your code,…
-
2
votes2
answers95
viewsA: What is the combination of table and float?
1) The effect of table in float it’s not any, only that table has another display (table) unlike display: block of the div. How table has always been used to have elements inside the display of this…
-
1
votes1
answer40
viewsA: Calling Javascript function at the wrong time
You have bootstrap classes in the wrong order; modal-content is what encompasses the content of the modal, while zoom is what is encompassed by modal-content and encompasses the image. You also have…
-
0
votes1
answer247
viewsA: Leave a read menu with treeview active after page re-load
You will need to record this information in the customer’s browser (either by cookies, or by Google, or in any way you think is acceptable) and when you load the page check if this preference exists…
-
1
votes3
answers732
viewsA: Recursive function with for
Your doubt is "why the for is saving the value of i = 2 after the base case is hit?" This is because javascript has function scope instead of block scope, and the initialisation of i is done within…
-
4
votes1
answer1397
viewsA: Customize Html5 player volume bar
You can use the "new" input type=range with min=0, max=1 and step=0.1, when the onchange it does the assign of volume for this.value: <audio id="demo"…
-
0
votes2
answers170
viewsA: Deactivate Combo select
You’re one down ' on the line document.getElementById('mespgto).disabled=true example in fiddle function liberar() { if (document.getElementById('radios03').checked == true) {…
-
0
votes1
answer60
viewsA: Function call within Modalbox
The problem with your code is that you are calling the plugin zoom harm: the documentation says you have to add the "event" zoom to an element than an img tag So, switching your html from modal to:…
javascriptanswered MoshMage 1,789 -
0
votes3
answers2419
viewsA: How can I calculate elements in Javascript
If it is worth changing the HTML, you can always make a selector that selects all the elements when one of these is changed, calculate the percentage of it, reduce the list to the sum of them and…
-
1
votes1
answer95
viewsA: What is the difference between Observables and common Javascript events?
The main difference between the two is that a Observer it serves for when something mute, whereas a Event occurs when something happens. The practical example of this would be, in a whole list: The…
-
1
votes3
answers666
viewsA: While loop - number counter minus 0
you can use a array, do the push whenever the value is not 0 and, at the end, return the length of array: var numbers = []; function loopPrompt() { var input = prompt('Number? [0 escapes]'); if…
-
1
votes2
answers169
viewsA: Selects selected from object
You will have to use one of the iteration modes up the object and produce each option hence. You can use the ng-repeat or the ng-options. I prefer the ng-options because we do not have to…
-
3
votes2
answers85
viewsA: Function Optimization (probably with for loop)
Your code has some CSS problems (and as @Sergio explained in his reply) a lot of repetition. Since your question is "how to optimize function". (link to example in Jsbin) We start by redesigning…
-
1
votes1
answer112
viewsA: How to reorganize Ivs (moveup / movedown)
The first problem you have in your code is that you are re-adding the on-click Event of all "moveUp" and "moveDown" each time you add anything; This causes, each time you click one of the buttons -…
-
3
votes2
answers1666
viewsA: Manipulate all images from a directory without having to access
After thinking... (theoretically) There’s a way to do this client-side. It’s not, at all, advisable. window.loadPatternImages = function() { var _this = this; this.fileTemplate = "%.jpg";…
-
1
votes1
answer76
viewsA: How to simulate this PHP function in jQuery?
If the goal is to filter to get the field later, you can use the array.filter() -- if it is to take the index, you can use the array.forEach() the equivalent of stripos is "string".indexOf() and you…
-
0
votes2
answers47
viewsA: How do I add more than one domain to this alert?
You have to have, as @Roberto says, a list of domains: var dominios = ["dominio1.com", "dominio2.com"]; after a simple iteration on this array, joins with the window.location.hostname tells you…
-
1
votes1
answer48
viewsA: Use the id of two different pages in Jquery
You can use the window.location with hash Location; When the user clicks on the button criar he changes the href to have a hashtag "create". On the second page, you make a onDomReady with jQuery…
-
1
votes2
answers15005
viewsA: How to place an image in an HTML button
In the case of a website, files cannot be served from your local system. First, because the system where the site will be hosted will not (certainly) have the same system as yours (it may, for…
-
0
votes1
answer243
viewsA: jQuery + Angularjs + Materialize CSS error
angular.element cannot make css-selectors newm by tagname nor by .classname to make that selection you have two chances: a) Includes jQuery first that the Angular, thus the angular.element is an…
-
0
votes3
answers43
viewsA: how to execute a specific button on a list of 5 identical buttons
You’ll have to add a class to your own anchor tags, like this: <div class="wrapper"> <a id="1" class="edit">E</a> <a id="2" class="edit">E</a> <a id="2"…
-
2
votes1
answer938
viewsA: Logged in user information does not appear using Firebase!
First you have to start the application with firebase.initializeApp({ apiKey: "<API_KEY>", authDomain: "<PROJECT_ID>.firebaseapp.com", databaseURL:…
-
1
votes1
answer198
viewsA: Doubt - Session with Angularjs + PHP
If I understand correctly, when you’re seeing if the answer is right or wrong, you should make a push: or with the user’s response, or with a boolean value; as you plan to send the data or use it in…
-
1
votes1
answer38
viewsA: Test Pages within 5 seconds loading pattern
I do not know if this is the right way to solve the problem, and if it is no longer worth your server to load a first page, do a timestamp before and after, and consider whether the user will be…
-
0
votes1
answer66
viewsA: Problem with array comparison
@Ingi you can’t compare arrays as strings, the most you can do is make a JSON.stringify() of the two arrays and compare the result string OR loop through the two arrays and check whether an item is…
javascriptanswered MoshMage 1,789 -
0
votes1
answer1469
viewsA: Problem with multiple forms on the same page
Tries to add a class to send, change your type to button instead of Submit - after that, you bind the click on that element to serialize the inputs that belong to that form. still in that element,…
-
0
votes3
answers168
viewsA: Function calling other functions
If what you want to do is a user input validation (and you don’t need to make ajax calls or more complicated things) you can just use patterns and the type HTML already gives you: <input…
-
1
votes1
answer37
viewsA: Show elements according to click
Well, you can always use one hide class together with a partial, <div id="recordatorio" class="partial hide"> then something like (pseudo-code):…
-
0
votes2
answers2056
viewsA: Auto scroll down bar in chat div(window)
In your anonymous message-adding function, you have to do a animate with scrollTop with the value to offset of the element in relation to the top: $('html, body').animate({ scrollTop: $("#jan_"+i+"…
-
0
votes1
answer97
viewsA: Jquery does not display image prewier
Might have something to do with you wearing a self invoking function [at the beginning of Document]* instead of using ready jQuery; a self-invoking-Function is racing so that the javascript engine…
-
2
votes3
answers1392
viewsA: Grab content from div, a, select
https://jsfiddle.net/v21p62t7/1/ basically, you have to do an event onchange in your select and a onclick in sections with the class valor; However, you should add one more data-attribute called…