Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

281
Views
Controlador angular que envía y recibe datos hacia/desde un servidor Nodejs

Sobre la base de esta solución aquí , estoy trabajando para poder recibir una respuesta del servidor del nodo.

Controlador angular

 $scope.loginUser = function() { $scope.statusMsg = 'Sending data to server...'; $http({ url: 'http://##.##.##.##/login', method: 'POST', data: user, headers: {'Content-Type': 'application/json'} }) }

Servidor Nodejs

 app.post('/login', function(req, res) { console.log('Processing request...'); res.sendFile('/success.html'); });

¿Cómo se puede ampliar este ejemplo para poder recibir una respuesta del servidor?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

$scope.loginUser = function() { $scope.statusMsg = 'Sending data to server...'; $http({ url: 'http://##.##.##.##/login', method: 'POST', data: user, headers: {'Content-Type': 'application/json'} }).then(function(response) { //do something with your response from the server console.log(response.data) }) }

En su ruta /Post, normalmente estaría enviando datos desde su controlador para posiblemente consultar una base de datos y enviar algunos datos a través de JSON.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!