Search Posts

Category: node.js

Send JSON from angular.js to node.js

If I send a JSON from frontend angular.js to backend node.js, it give me an error: TypeError: Cannot read property username of undefined. I’m using also Express. Frontend (Angular.js): var username_data = $scope.LoginUsername; var password_data = $scope.LoginPassword; var data = {username : username_data, password : password_data}; $http.post(‘/api/login’, data) .then(function (res) { //to do… }); Backend (node.js) with Restful API: app.post(‘/api/login’, function(req, res) { console.log(req.data.username); console.log(req.data.password); }); Source: AngularJS

Getting error while installing angular cli to create angular2 project

I am trying to create the first angular2 project and did some installation process which are given below. npm install -g angular-cli ng new my-new-app After running above command I am getting the following error. 2study/newapp/node_modules/.staging/selenium-webdriver-4a4eda8a/lib/test’ npm WARN tar ENOENT: no such file or directory, lstat ‘/opt/lampp/htdocs/angular2study/newapp/node_modules/.staging/selenium-webdriver-4a4eda8a/lib/test’ npm WARN tar ENOENT: no such file or directory, lstat ‘/opt/lampp/htdocs/angular2study/newapp/node_modules/.staging/selenium-webdriver-4a4eda8a/lib/test’ npm WARN tar ENOENT: no such file or directory, lstat ‘/opt/lampp/htdocs/angular2study/newapp/node_modules/.staging/selenium-webdriver-4a4eda8a/lib/test’ npm WARN tar ENOENT: no such […]

With Express and Angular, how can I receive the results of a search in the front end javascript file so I can filter the results?

I understand how to receive the information with eJS or Jade, but I don’t know how to get it to the Front End Javascript. Currently the workflow of the Website is the user clicking on the ‘See All NPC’ to see the data without a filter. This looks like website.com/NPC/?s=. The user can use a search bar on the page to reload the page as website.com/NPC/?s=. Currently I display the data with Angular from the […]

node js returned json results are not showing in angular js

Iam using Node js(8.9.4) as backend server, angular js(1.6.4) as frontend, DB is MySQL 5.6. From home page when i click generatereport button iam calling the nodejs URL to get the values from DB and forward the results to vendorcompliances.html. Iam getting values from DB and even in the console but it is not showing in html file. I didnt see any error in the console or node js logs. I have searched in google […]

Remove first object from json on checkbox click – AngularJs + NodeJs

This is my JSON object: [ { field1: ‘gsm’, field2: ‘firstname’, field3: ‘lastname’, field4: ‘street’, field5: ‘city’, field6: ‘region’, field7: ‘postcode’, field8: ‘dob’, field9: ’email’, field10: ‘company’, field11: ‘url’, field12: ‘country’, field13: ‘data1’, field14: ‘data2’, field15: ‘data3’ }, { field1: ‘123456789’, field2: ‘Mohamed’, field3: ‘Sameer’, field4: ‘Salai’, field5: ‘Salai’, field6: ‘Asia’, field7: ‘111111’, field8: ’10-10-10′, field9: ‘[email protected]’, field10: ‘ifelse’, field11: ‘ifelse’, field12: ‘India’, field13: ‘test’, field14: ‘test’, field15: ‘test’ }, { field1: ‘123456789’, field2: ‘Hameed’, […]

Is it necessary to use Angular with Meteor

I am angular developer.Angular is really useful for building single page applications. I am learning Meteor which seems even more capable, especially since they have a feature called DDP which basically allows bi-directional data streaming. Meteor automatically update the DOM as well. Could someone explain why I would want to Angular with Meteor or even use any MV* front-end framework if I were to use Meteor? Source: AngularJS

Getting “npm ERR! code ENOVERSIONS” on ng new project

Whenever I am lanching any angular new prject I am getting this error. npm ERR! code ENOVERSIONS npm ERR! No valid versions available for timed-out For example:- ng new training-app installing ng2 create .editorconfig create README.md create srcappapp.component.css create srcappapp.component.html create srcappapp.component.spec.ts create srcappapp.component.ts create srcappapp.module.ts create srcassets.gitkeep create srcenvironmentsenvironment.prod.ts create srcenvironmentsenvironment.ts create srcfavicon.ico create srcindex.html create srcmain.ts create srcpolyfills.ts create srcstyles.css create srctest.ts create srctsconfig.json create angular-cli.json create e2eapp.e2e-spec.ts create e2eapp.po.ts create e2etsconfig.json create […]

to delete data from mongodb using angularjs and nodejs

// remove user function() $scope.removeUser = function(_id,$index) { alert(‘Are you sure you want to delete?’); var data={productid:_id}; alert(data.productid); $http({ url: ‘http://localhost:3100/manage-product’, method: ‘POST’, data: data.productid, }).success(function(res) { console.log(‘another success’); }, function(error) { console.log(error); alert(‘here’); }); } request body is empty at node.js,why is it so.? node.js app.post(‘/manage-product’, function(req, res){ console.log(‘I received another get request’); console.log(req); var removeproducts = function(db, callback) { console.log(“entered”); db.collection(‘users’).deleteOne({_id : ObjectId(req.body.productId)}, function(err, results) { console.log(‘product deleted’); callback(); }); }; }); This […]

Not able to add new property to mongoose result

I have a userDetail document which has all the details regarding the user. I have a login document which has a time of the first login which I want to add to the result of the userDetails. Here is the Code on my Nodejs server application. Login.findOne({email:req.body.email},(err,loginDetails)=>{ if(!err){ if(loginDetails===null){ //user is not already logged in //saving login new details let newLogin=new Login(); newLogin.email=req.body.email; newLogin.userType=user.userType; newLogin.save((err,loginDetailsAfterSaving)=>{ if(err){ res.status(500).send(err); } let token=jsonwebtoken.sign(user.toJSON(),”example1″); res.status(200).json({token:token}); }); } for adding […]

What is the best approach for language translation in web applications [on hold]

My web application has some bulk text contents, I need to add language translation for that particular contents, It has edit option also which means user can edit the contents if they required so i can’t statically store the translated text also. How to handle language translation in best way for this scenario. If i translated every time when user clicks particular language means it will not be a cost effective. So please give some […]

Next Page »