Search Posts

Category: node.js

Unable to send sign up data from front-end to backend

I am trying to make an HTTP request from AngularJs to Nodejs. The error I am getting is: Failed to load localhost:4000/Register: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. Code for my http request: $scope.sendData=function () { var dataObj = { fname : $scope.user.fname, lname : $scope.user.lname }; var myJSON = JSON.stringify(dataObj); var request = $http({ method: “post”, url: “localhost:4000/Register”, headers: { “Access-Control-Allow-Origin”: “*”, “Access-Control-Allow-Methods”: “GET, POST, PUT, […]

loading image using anglularjs and ibm bluemix

I developed an application using nodes and angularjs. I have an html file that I should display an image. when running the application on localhost, everything work perfectly and the application displays the image. I used this code for displaying image: <img ng-src=”./app/images/{{idimage}}.jpeg” ></img> when I do a push for this application to ibmbluemix, the console told me that there are a 404 not found error. Any idea please for how displaying image using angulars […]

Trying to validate a password to allow access to next view

Using AngularJS I am stuck trying to validate a form input that takes in a secret that when correct will allow access to the next view. HTML <form ng-submit=’adminPermission(secret_key)’> <div class=”login-form-username-container”> <div class=”login-form-username-text”>Secret</div> <input id=”username-input” type=”text” ng-model=”secret_key” placeholder=”Secret Key” required> </div> <div class=”submit-login”> <button id=”button-text” type=”submit”><strong>Check</strong></button> </div> </form> controller $scope.adminPermission = function (secret_key) { adminService.adminPermission(secret_key) .then(function (response) { if (! { console.warn(“Unable to get creds”); } else{ $state.go(‘newadmin’); } }); }; service` this.adminPermission = (secret_key) […]

Peerflix-server. Generate player page for each torrent

I use peerlix-server and I want to generate a page with the player for each torrent. There are app and server dirrectories. app ├── 404.html ├── favicon.ico ├── images ├── index.html ├── robots.txt ├── scripts │ ├── app.js │ ├── controllers │ │   └── main.js │ └── services │ └── torrent-socket.js ├── styles └── views ├── main.html └── page.html server ├── bin.js ├── engine.js ├── ffmpeg.js ├── index.js ├── progressbar.js ├── socket.js ├── stats.js └── […]

MEAN advanced books [on hold]

First of all, sorry for this kind of question, learning from video tutorial is not good sometimes and that knowledge is not stable so I decided to learn from books. By googling I could get an answer, I need human recommendation who has more experience. So share everything that you found it as helpful. I believe it will be helpful for everyone. Thank you in advance. Source: AngularJS

POST 404 Error when deploying MEAN app on Heroku

I was recently following a tutorial on youtube that went over creating a MEAN application locally. I decided to try to deploy my version over heroku and run into the error when adding an item: POST 404 (Not Found) as well as GET 503(Service unavailable) Possibly unhandled rejection:{} my server.js file is: let express = require(‘express’); let app = express(); let bodyParser = require(‘body-parser’); let mongoose = require(‘mongoose’); let mongodb = require(“mongodb”); let ObjectID […]

Show subtasks(related to the task) in Angular js

Sorry if the title was confusing, I’m creating a web application which lets the user to add tasks and sub-tasks.I have managed to make angular to get the tasks from database(mongodb) and show the result in my dashboard.html file. But I’m having problems with the sub-tasks. I have a button on each task and when clicked should show all the sub-tasks which belong to that task. In the current situation the problem is that when […]

Cross Origin Post Request Angular js

I’m trying to make a post request using Angular js, but it doesn’t work. The origin url is different from server. The server is a Node Express app and its base url is “localhost:3000”. Client is a java web app running on a Tomcat server, and its base url is “localhost:8080”. My server has the following files: app.js: var createError = require(‘http-errors’); var express = require(‘express’); var path = require(‘path’); var cookieParser = require(‘cookie-parser’); var […]

How to pass an object param with $http POST and access in Nodejs service

I have created a POST request where i am sending a param to server and in the server side i am getting the error is like the data not found. Client js var postData= JSON.stringify({name:”Alex”,age:”34″}); var deferred = $q.defer(); $ + ‘/users’, postData) .success(function (response) { deferred.resolve(response) }).error(function (error) { deferred.reject(‘Failed to connect’); }); return deferred.promise; } Serverjs (Nodejs)‘/api/users’, function (req, res) { var user = req.body.postData; // user is not getting in server […]

Next Page »