Skip to content

Instantly share code, notes, and snippets.

@davelnewton
Last active April 8, 2017 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davelnewton/638c51db5b804348353a661ab519022d to your computer and use it in GitHub Desktop.
Save davelnewton/638c51db5b804348353a661ab519022d to your computer and use it in GitHub Desktop.
Beautified JS
var express = require('express');
var router = express.Router();
var mongoose = require('mongoose');
var Question = require('../models/Question.js');
var app = express();
// GET questions listing. questions/yourroute
router.get('/', function(req, res, next) {
Question.find(function(err, questions) {
if (err)
return next(err);
res.json(questions);
});
});
router.post('/saved-questions', function(req, res) {
var now = Date()
User.findById(user.id, function(err, user) {
var newanswer1 = {
question: '58ccb991caf9756f8e1d8a6c',
answer_text: req.body.Q1,
postdate: now
}
});
user.users_answers.push(newanswer1);
//repeat for Q 2 and 3, push each time
User.save()
});
module.exports = router;
<div id="questions" ng-controller="QCntrl">
<ion-content>
<ion-slide-box>
<ion-slide>
<div class="intro" ng-controller="PopupCtrl">
<h1 class="hidden">Intro Question</h1>
<h3>Just need to ask some questions to make this app personalized for you</h3>
<button class="button" value="next" ng-click="nextSlide()">
OKAY
</button>
<button class="button2 button-positive" ng-click="PopAlert()">
Why?
</button>
</div>
</ion-slide>
<ion-slide>
<div id="Q1box">
<h2>{{questions[0].question_text}}</h2>
<ul>
<li data-ng-repeat="answer in answers1">
<ion-checkbox id="Q1" ng-model="filter.users_answers">{{answer.label}}</ion- checkbox>
</li>
</ul>
<a href="#" ng-click="next()">Next Question</a>
</div>
</ion-slide>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment