Skip to content

insert from inside #4

@cungkrinx666

Description

@cungkrinx666

how can i fix problem to add user after login

//this my index.controller
(function () {
'use strict';

 angular
     .module('app')
     .controller('AddUsers.IndexController', Controller);

 function Controller($window, UserService, FlashService) {
        var vm=this;
        vm.user=null;
        vm.addUser=addUser;

        function addUser() {
        UserService.Create({
            error: response.body,
            firstName: req.body.firstName,
            lastName: req.body.lastName,
            gender: req.body.gender,
            address: req.body.address,
            phone: req.body.phone,
            level:req.body.level,
            username: req.body.username
        })
            .then(function () {
                FlashService.Success('New user Created!');
            })
            .catch(function (error) {
                FlashService.Error(error);
            });
    }

 }

})();

//this my api users.service

router.post('/', CreateUser);

function CreateUser(req, res) {
userService.create(req.body)
.then(function () {
res.sendStatus(200);
})
.catch(function (err) {
res.status(400).send(err);
});
}

please fix this where can i put the user.param..i tri to use vm.user like an update script but that failed.. :)

but i jus want the say you are THE BEST and be a my inspirator.. ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions