Search Posts

Category: mean-stack

Go back and forward between two pages

I have a website by mean-stack. I want to add a web page https://localhost:3000/A. This page contains a textarea where people could write a text, it also contains a button go forward to Page B. Thus clicking on the button leads to https://localhost:3000/B. Page B prints the text (which can not be edited) that was written in Page A. It also contains a button go back to Page A, which leads back to Page A. […]

Angular.bootstrap after ocLazyLoad

I am developing an Office add-in by mean-stack. For some reasons, I have the following constraints: I cannot use <body ng-app=”app”>, thus I have to use angular.bootstrap I cannot load office.js globally, thus I need to load it with ocLazyLoad I need to call Office.initialize = function (reason) { … } after loading office.js I have written the following code, which does not work (even abc is not printed): myApp = angular.module(‘app’, [‘ui.router’, ‘oc.lazyLoad’]); myApp.config(‘$stateProvider’, […]

Route.delete() requires a callback function but got a [object Undefined]

Keep getting this error but can’t figure out what is wrong with my delete function. “Route.delete() requires a callback function but got a [object Undefined]” const playerController = { index: (request, response) => { Player.find({}) .then(player => response.json(player)) .catch(error => console.log(error)); }, create: (request, response) => { Player.create(request.body) .then(player => response.json(player)) .catch(error => console.log(error)); }, delete: (request, response) => { Player.remove(request.params.id) .then(player => response.json(player)) .catch(error => console.log(error)); //console.log(‘node function’); } }; //- – – – […]

One mean-stack project for 2 websites

I have one mean-stack project which serves at the moment 2 set of web pages: www.myweb.com/… (except key) and www.myweb.com/ABC/…. I decided to manage them in one project because they have common things to share. For example, they can share some JS files including controllers and providers, while their html files are quite different. They share one database as well. Now, I realise that this approach has some fundamental conflicts. So I’m trying to split […]

Cryptic failure of custom AngularJS service [duplicate]

This question already has an answer here: Why are angular $http success/error methods deprecated? Removed from v1.6? 2 answers I am trying to follow along with the mostly good but dated book Getting MEAN with MongoDB, Express, AngularJS and Node and am in a section where hardwired data in a controller is being replaced with a call to a custom API that I already built and is certainly working, as determined by tests with curl. […]

MEAN-stack app: REST API calls from angular2 frontend to express backend do not work. Error: ERR_CONNECTION_REFUSED

I am building a MEAN stack app, following this tutorial: https://www.youtube.com/watch?v=PFP0oXNNveg&t=3236s The Problem: I try to do http.get() request from my angular2 frontend to my express backend. It does not work and i get the Error: ERR_CONNECTION_REFUSED: The Error My frontend is on localhost/4200 and my backend on localhost/3000. I figured the problem might be that, so i search for solutions and tried everything described in here: Angular-CLI proxy to backend doesn't work (solution to […]

How to change the data in script tags in html from js?

I have the following script tag in my html, <script type=”application/ld+json”> { “@context”: “http://schema.org”, “@type”: “VideoObject”, “name”: “Title”, “description”: “Video description”, “thumbnailUrl”: [ “https://www.xpertdox.com/assets/images/XperDox_Cover_Art .png” ], “uploadDate”: “2015-02-05T08:00:00+08:00”, “duration”: “PT1M51S”, “embedUrl”: “https://www.youtube.com/watch?v=LDIYgpraBHA”, “interactionCount”: “2347” } </script> I want to append values to this through my js file,like “name”: “My Title”, “description”: “My description” But i dont know how to assign values to the script tag form js.I am using angular js.Can anyone please suggest me […]

Is it possible to use router.get after having been using ngRoute?

I’ve been using Angular’s ngRoute and .when for displaying the hmtl routes of my application. For this I have configured a main route: var appRoutes = require(‘./backend/routes/api’); I was trying to add another route this way but most of the html wasn’t displaying correctly, so I configured another main route: var questions = require(‘./backend/routes/questions’); in the file where I use Angular’s ngRoute with .when, I added a route for /questions but it doesn’t load it […]

Next Page »