Search Posts

Category: ajax

Angular ajax image not updating

So I have the following code: <body lang=”en-US” ng-app=”socket-server” ng-controller=”imageValidationController”> <div class=”image-panel”> <h1>Images Found:</h1> <div class=”image-list” ng-repeat=”image in images”> <p>Image size: {{image.size}}</p> <p>Width: {{image.width}}</p> <p>Height: {{image.height}}</p> <img class=”image” ng-src=”{{image.image}}”> </div> <p>Total images found: {{num_images}}</p> </div> and I have the following javascript: var app = angular.module(‘socket-server’, []); app.controller(‘imageValidationController’, function($scope, $http) { $http({ method: ‘POST’, data: ‘html=<html><body><img src=”https://media.giphy.com/media/lhvyCCcFuQFKo/200.gif”></body>’, url: ‘/app/image-validation’, headers: {‘Content-Type’: ‘application/x-www-form-urlencoded’} }) .then(function(response) { $scope.images = response.data.images; $scope.num_images = response.data.num_images; }) }) /app/image-validation returns an […]

Does AngularJS Route needs to import the same script in all the views that is needed?

I have my main thread and it imports at the end of it a script with all my ajax calls, but when I call a view that uses that script I need to reimport the script on that view and I get a “jquery-2.1.1.min.js:4 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help, check https://xhr.spec.whatwg.org/” Source: AngularJS

ng-repeat Return empty rows

I tried with below code, but it is returning an empty row (more than 30+) of the table. json [ {“COMPANY_ID”:”1″,”COMPANY_DESC”:”11″,”COMPANY_CURRENCY”:”1″,”ACTIVE”:true,”IS_HEADOFFICE”:true,”ACCOUNTING_SYSTEM_ID”:”1″}, {“COMPANY_ID”:”2″,”COMPANY_DESC”:”2″,”COMPANY_CURRENCY”:”22″,”ACTIVE”:false,”IS_HEADOFFICE”:false,”ACCOUNTING_SYSTEM_ID”:”1″} ] Html <tr ng-repeat = “company in companies track by $index””> <td>{{ company.COMPANY_ID }}</td> <td>{{ company.COMPANY_DESC }}</td> <td>{{ company.COMPANY_CURRENCY }}</td> </tr> App <script> var app = angular.module(‘myApp’, []); app.controller(‘customersCtrl’, function($scope, $http) { $http.get(“http://localhost:52087/api/accountmapping”) .success(function (response){ $scope.companies = angular.fromJson(response); console.log(angular.fromJson(response)); }); }); </script> Source: AngularJS

Cors error when i access to a JSON local file

i’m getting a error when i trying to access to a local JSON file. This is my function to bring the data from the json. $scope.getJSON = function () { (self.servicioObj = jsonFactory.GetJson(‘data.json’)).then( function (dataResponse) { $scope.datosJson = []; $scope.datosJson = dataResponse.data; self.servicioObj.detenerTiempo(); }, function (error) { self.servicioObj.detenerTiempo(); }); } And this is my Factory code. function jsonFactory($http, $q) { var self = this; self.urlBase = ‘http://192.168.0.17:8383/NewFrontEnd/app/pages/’; self.jsonFactory = {}; self.tiempoEspera = 120000; self.jsonFactory.GetJson = […]

angular doesn’t work with multi step form

I am new in using Angular and I use Angular 1.6 I have a form with multi steps, and each step sends with Ajax by clicking on next or prev button and data loaded on the page. these requests send by ajax jquery (don’t send with angular) I have a problem when I click on next or prev button and another step loaded when the page loaded: the angular $scope undefined and my code doesn’t […]