Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var common = require('../common');
- var inviteeSchema = common.Schema({
- email: String
- });
- var Invite = common.conn.model('Invite', inviteeSchema);
- module.exports = Invite;
- router.route('/addtoinvitelist').post(function (req, res, next) {
- var invite =new Invite(req.body);
- invite.save(function(err,email){
- if(err) throw err;
- res.json({message:"your mail id is stored in our database we will soon send you an invite"})
- });
- });
- <form action="#">
- <div class="form-group">
- <label for="subcribeNewsletter" class="control-label">INVITE FORM<br> <small>We are happy to invite you to medicoshere, So please enter your email ID in the below form.</small></label>
- <div class="input-group input-group-in input-group-sm">
- <div class="input-group-addon"><i class="fa fa-envelope text-belpet"></i></div>
- <input class="form-control" id="subcribeNewsletter" placeholder="name@mail.com" ng-model="useremail" required>
- <div class="input-group-btn">
- <button type="submit" class="btn btn-default text-belpet" ng-click="AddToInviteList(useremail)"><strong>OK</strong></button>
- </div>
- </div>
- </div><!-- /.form-group -->
- </form><!-- /form -->
- $http({
- method: 'POST',
- url: "http://localhost:3000/users/addtoinvitelist",
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded'
- }, // set the headers so angular passing info as form data (not request payload)
- data:"email"
- }).success(function (data) {
- console.log("email is posted sucessfully" + data);
- cb(data);
- })
- }`
- App.controller('InviteController', function ($scope, $rootScope, $routeParams, $location, UserServices) {
- $scope.init = function () {
- console.log("hii this is a test ")
- };
- $scope.email = {};
- $scope.AddToInviteList = function () {
- UserServices.AddToInviteList($scope.email, function (dataresponse) {
- console.log(dataresponse);
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement