meanjs

registerModule with dependencies

☆樱花仙子☆ 提交于 2019-12-06 01:43:32
问题 I'm building an app with MEAN.JS and I'm trying to use a controller from another module. I've found that I can do this with dependency injection: angular.module(‘MyModule’, [‘Dependency’]); But the way modules are created in MEAN.JS is: ApplicationConfiguration.registerModule('MyModule'); And I can't just pass a second parameter to registerModule . So, how should I do this? Do I have to use both methods? Am I doing it wrong? Example I want to add a new model: Campaign . Campaigns are created

NodeJS logout all user sessions

↘锁芯ラ 提交于 2019-12-06 01:37:47
I'm interesting to close (logout/sign out) all the user sessions in nodeJS . req.logout() is closing only the current session of the user. But for my security panel I want to add the option to close ALL the user sessions. How can I do this? I'm using MEAN.JS framework . With passport.js library and mongoDB to save the sessions: // Express MongoDB session storage app.use(session({ saveUninitialized: true, resave: true, secret: config.sessionSecret, cookie: { maxAge: 15778476000, httpOnly: true, secure: false }, key: 'sessionId', store: new mongoStore({ db: db.connection.db, collection: config

MEANJS user profile functionality

大兔子大兔子 提交于 2019-12-05 17:28:57
i'm trying to build a simple app using meanjs. i have 2 modules: the standard user module and a posts module. what i want to achieve is a user profile page which will display some info about particular user and list posts belong to that user. you can think of it as a twitter profile page. i thought it would also be best /users/username shaped url structure. but i'm fairly new on all this and now stuck. here is what i did so far: i added these lines into users.server.routes.js: app.route('/api/users/:userName').get(users.userByUsername); app.param('userName', users.userByUsername); added a

Mongoose & float values

随声附和 提交于 2019-12-05 04:21:48
My lat & lng numbers are being converted to strings. My section integers are still the correct data type of Number. How do I set up model so that I can get my lat & lng back out as Float rather than String? I'm storing latLng data in my db. Right now I have my data type set to Number for lat & lng. When I check out my db I see this: { "_id" : ObjectId("563bd98a105249f325bb8a7e"), "lat" : 41.8126189999999980, "lng" : -87.8187850000000054, "created" : ISODate("2015-11-05T22:34:50.511Z"), "__v" : 0, "section" : 0, } But when I get my data back out using express I get this: { "_id":

registerModule with dependencies

怎甘沉沦 提交于 2019-12-04 06:10:47
I'm building an app with MEAN.JS and I'm trying to use a controller from another module. I've found that I can do this with dependency injection: angular.module(‘MyModule’, [‘Dependency’]); But the way modules are created in MEAN.JS is: ApplicationConfiguration.registerModule('MyModule'); And I can't just pass a second parameter to registerModule . So, how should I do this? Do I have to use both methods? Am I doing it wrong? Example I want to add a new model: Campaign . Campaigns are created by admins only, but can be seen by the "campaign owner" (another User ). The create campaign form

where should I add module dependencies in mean.js (for ng-sortable)

不羁的心 提交于 2019-12-04 06:08:47
I am trying to add ng-sortable to my mean.js based app. https://github.com/a5hik/ng-sortable Following the install instructions and adapting them to mean.js I included the js and css files (which are loading correctly), but where I fall down is adding module dependencies: And Inject the sortable module as dependency. angular.module('xyzApp', ['ui.sortable', '....']); My angularjs controller looks like this: var listers_mod = angular.module('listers'); listers_mod.controller('PagesController', ['$scope', '$http', '$stateParams', '$location', 'Authentication', function($scope, $http,

TypeError: The “digest” argument is required and must not be undefined

烈酒焚心 提交于 2019-12-04 02:09:58
I am getting subject error while registering a simple Mean Application through http://localhost:3000/auth/register , that I have simply created using mean init command. pbkdf2 or crypto is generating the error and I have no idea where to look for it. I have done lots of different things like cleared npm cache, reinstalled using npm etc. Please help me out. Following is some more information. Mean --version: 0.12.15 npm --version: 5.0.3 node --version: v8.1.0 bower --version: 1.8.0 gulp --version: CLI and Local: 3.9.1 Code for model.UserSchema.methods.hashPassword (D:\Projects\Mean

how meanjs implement admin dashboard

偶尔善良 提交于 2019-12-03 21:33:14
meanjs use angularjs for front end mvc , and is a SPA application , so when the admin dashboard is diffrent than the front end page , what is the best way to implement admin dashboard ? perhaps two access points ? I've been looking for a way to achieve this also and I'm posting here the result of my search. First create your new module: yo meanjs:angular-module admin yo meanjs:angular-route adminHome ? Which module does this route belongs to? admin ? What do you want your route path to be? admin-home ? What do you want to call your view? admin-home ? What do you want to call your controller?

Blank page on Heroku - mean.js angular app

折月煮酒 提交于 2019-12-03 11:53:28
问题 I'm trying to deploy my mean.js app to heroku. Somehow the app on heroku is loading a blank page. It seems like the angular app is not being loaded properly. Possibly a problem with bower dependencies? Please take a look at the blank heroku app. The heroku logs show no errors. No angular errors either. I would appreciate any help. 回答1: OK, I feel stupid. It took me a while to realize that while my mean.js app is running in production mode, none of the client side javascript got loaded. It

Specifying Mongo Query Parameters From Client Controller (MEAN.JS)

微笑、不失礼 提交于 2019-12-03 07:30:55
I am building an application using MongoDB, Angular, Express, and Node (MEAN stack). I used the MEAN.JS generator to scaffold my application. I will use the articles module as a reference. Suppose I have 7000 records in my articles collection, and each record has a date associated with it. It is inefficient to load all 7000 records into memory every time I load the page to view the records in a table and I am seeing terrible performance losses because of it. For this reason, I would only like to load records with a date in the range of (1 Month Ago) to (1 Year From Now) and display them in the