Posts by Renan Degrandi • 936 points
39 posts
-
0
votes2
answers1393
viewsA: Child component calling another child component’s method
I can’t tell you if this is the best way to do it. But what you could do is. A - (Father) B - (Son) C - (Son) -> so HTML must look something like this: <a> <b (outputEmit)="emitted()"…
-
0
votes3
answers1253
viewsA: How to set the first value in the combo?
go to your controller. in the method: ngOnInit() { //Pode ser que tenha algo aqui. municipio.estado = estados[0]; } NOTE: If it is an async request that is filling the array of states, assign it to…
-
1
votes3
answers155
viewsA: Access a property’s value through a String
It has a slightly easier shape; eval('pessoa.animais.gato'); The argument of the function Eval() is a string. If the string represents a expression, Eval() evaluates the expression. Whether the…
-
1
votes3
answers912
viewsA: Angular Scope with apply no ng-init
Add in ng-init the call to its function (selected) in that, once ng-init is built it will trigger its function so that it triggers the call on the server, and fills its object that is used in…
angularjsanswered Renan Degrandi 936 -
1
votes3
answers11314
viewsA: if inside an ng-class in Angularjs
data-ng-class="{'classeAqui': sessao.tipo_2 != 3D, 'classeAqui': sessao.tipo_2 == 3D }" You must inform a configuration JSON for ng-class where you will pass Key: Class value: condition. Objeto = {…
angularjsanswered Renan Degrandi 936 -
1
votes3
answers480
viewsA: How to load an ng-controller through ajax and inject it into the DOM
If you only use $(). append() you will only be including the string in html and not updating the DOM. There is a directive that does all this work p/ we developers. app.directive('dynamic',…
-
3
votes1
answer92
viewsA: Is it possible to authenticate with Angularjs?
I didn’t quite understand your question, but I will apply an answer that I use. I authenticate a user with the server, using the http service, and if server-side authentication is positive, I return…
angularjsanswered Renan Degrandi 936 -
2
votes2
answers1351
viewsA: Check if a record came back-end null in Angular
First, you need to check how you are treating the "Find No Record" factor on the server side. I would use 2 ways from the server side. 1st found record, return a Request with Status 200 (Ok), found…
-
1
votes2
answers84
viewsA: How to work with Angularjs without the API being ready?
I don’t know any API, but you can do it this way. $scope.jsonTeste = { "prop": true, "prop2": false } // Add your json here. then you change to your request. $http(url).then(function(retorno) {…
-
0
votes1
answer954
viewsA: How to show data from a Session in Angularjs?
within your controller, after its function, Btnlogin, add a call to your systemService service by calling the 'get' function you created by passing the key (name) you created in sessionStorage, and…
-
0
votes4
answers1748
viewsA: Return php data to Angularjs
in the function below, you do not have the variable user, it will be Undefined, when you use the Get service, you can only pass a parameter "url", in case you are passing 2 Url parameters and one…
-
1
votes2
answers122
viewsA: Use token to access a platform
you are using the POST method the wrong way, $http.post('http://localhost:3000/login', $scope.data.session_email, $scope.data.session_password) when you inform that it is a post, you can use 2…
angularjsanswered Renan Degrandi 936 -
4
votes1
answer1172
viewsA: Returning JSON from a Factory to a controller with Angularjs
First thing, when you make a request $http, you are working Assyncronamente, which means its function. retornaDados : function() { return $http({ url: '../dados.json', method: 'GET' })…
-
0
votes2
answers987
viewsA: Angularjs | How to define a boot process for a controller?
First create a controller in your file . js app.controller('controlador', function($scope){ $scope.funcao = function(){ //algoritmo. }; }); then in your html, declare this controller <div…
-
2
votes1
answer1320
viewsA: Receive parameter in delete request
the delete service of the $http method, returns you a promisse ie, to access server return data, must be implemented as follows. the delete service does not accept an OBJECT to be sent, because the…
-
2
votes2
answers1538
viewsA: sum of values with ng-repeat
Convert your String (report.VALOR_COMISSAO) to Float, once its attribute is in string it is concatenating the values. $scope.GetTotal = function () { var total = 0; for(var i = 0; i <…
-
0
votes4
answers2160
viewsA: When filling in the Date field, perform a jQuery action
we can also add the onBlur event directly into the input. <input id="dp1" onblur="mascaraData(this);" class="input-small" onkeyup="mascaraData(this);" name="data" type="date"…
-
2
votes3
answers360
viewsA: Input type="text" field does not fill data with more than one word
<input type="text" value="'.$result->name.'"> add (") or document.getElementById('inputText').value = <?php $result->name ?>…
-
4
votes2
answers5078
viewsA: Adding variables with Javascript
You need to declare the variables in your function to have access to msm within the function, as soon as , declaring it within the IF block, you will only have access to this code block, declaring…
javascriptanswered Renan Degrandi 936 -
9
votes3
answers27643
viewsA: Get checkbox values with javascript
function soma(){ var pacote = document.getElementsByName('Pacote'); for (var i = 0; i < pacote.length; i++){ if ( pacote[i].checked )…
javascriptanswered Renan Degrandi 936 -
6
votes6
answers14101
viewsA: String Format with Javascript
I use the replace. var teste = "Teste {0}"; teste = teste.replace("{0}", "Sucesso");
-
1
votes3
answers4238
viewsA: Jquery take the first and second tag inside a div
var element = $('#shipping_table').find('input'); element[0].click(function() { alert( "função aqui" ); }); element[1].click(function() { alert( "função aqui"…
-
1
votes2
answers1021
viewsA: How to restrict access to routes in Angularjs?
if you are using ui.router, you can use the event, $scope.$on('$stateChangeStart', function(event, toState, toParams, fromState){ if(regra) //Sua regra aqui. event.preventDefault(); // Utilizando…
-
3
votes1
answer1428
viewsA: Infinite scroll in Angularjs with external JSON
I do not use any plugin p/ do angular scroll Infinit, in my case. Html Example. <div data-ng-repeat="item in lista" data-infinit-scroll-page="loadInfinit()"> // nessa div eu coloco p/ dar…
-
5
votes3
answers1134
viewsA: How to access the $Cope variable?
When you access links the property with the variable $scope.teste you cannot access it with the Controller Alias {{bandas.teste}} you can access it as follows {{teste}}. to access the properties…
-
1
votes3
answers239
viewsA: jquery function does not work with routeprovider Angularjs
Complementing the above answer, if you create a directive, and inject in your input field, the directive will be executed After the creation of the field, with this the Jquery code will work, I…
-
2
votes2
answers314
viewsA: How to omit a specific ng-options item?
To not leave the code 'failed' in the ID: 301, step a more elegant solution. in the controller, you can add a business rule, and mark your object as checked, to true or false, (false in the case of…
-
3
votes3
answers476
viewsA: Undefined error while reading 'post' property in Angularjs
Add $http <--- before Function, as it was not declared, the object will be Undefined, so it does not find the function . post .controller('myForm', ['$scope', '$http', function($scope, $http) {…
-
1
votes1
answer230
viewsA: timeout to $http request (search for 5 seconds, if not found, returns 'error')
according to the website of the Angularjs. use a p/ http configurator. example below. $scope.method = 'GET'; $scope.url = ${API_URL}/carriers/correios/get-cep/${this.cep}; $scope.timeout = 10000;…
-
2
votes4
answers4345
viewsA: Stop and restart setInterval function
I modified the code to continue using your same idea. var countms = 0; var teste; var counterms = function() { teste = setInterval(function () { countms = countms + 1; var id_label_ms =…
javascriptanswered Renan Degrandi 936 -
1
votes5
answers3537
viewsA: Make div disappear
complemented above, if using Angularjs. <div id="panel" ng-show="false">
-
0
votes2
answers188
viewsA: Is there a jQuery selector that takes the html from its own tag and also the content?
If you use $(".quadro") at that moment you have all the elements that contain this class within it, and with that you can navigate the element and your children. if you use the method. html(), you…
-
1
votes1
answer117
viewsA: Making a Factory return data from an Ajax request
In your case you can implement a Promises, with this you can catch the return of the request. example of implementation. .factory('servico', function['$q', '$http', function ($q, $http) { return {…
-
4
votes1
answer515
viewsA: Access more object-specific data
You’re assigning the return. $scope.corretor = data; for the corrector variable, that is now your object is inside this variable, in your controller, you can access the property NOME as follows.…
angularjsanswered Renan Degrandi 936 -
0
votes2
answers694
viewsA: ng-click Does not work with elements created dynamically
This happens, why using the .innerHTML you are just linking in html a string code, but you are not "updating/linking" the events with the DOM, for that to happen I suggest the solution below. Create…
-
0
votes1
answer57
viewsA: How to use Named Parameters in Angularjs $http?
$http.get('/someUrl'). URL = 'api/controler/action?parameter1=xxx¶meter2=xxx' - in the case of a webapi2, it depends on the type of server you are consuming. $http.post('/someUrl',…
-
0
votes1
answer752
viewsA: Error with Asp.NET Web.API + Angularjs
Only with the above information it is difficult to help, however error 500 happens, why you do not have a specific treatment p/ return the error to screen, ie. in the DEBUG version of VS. your…
-
0
votes2
answers879
viewsA: Recover Error messages via json in Angular
When you call the functions errorClass('name'), errorMessage('name') you are passing the string "name" as parameter, that is, when it arrives in the function. var s = $scope.form[name]; This is…
-
2
votes2
answers88
viewsA: How do I edit the width of a class using Angularjs?
If you want to apply width to all elements that apply class, in the case "classe2", at runtime, you can apply. angular.element(".class2").width(500)