I am trying to insert data in mongoose using angularjs and node js. For this i have created a factory where i am calling another js file where i have created my database connection.
But when i tried to do this, it is giving me error.
Here is my factory method:
'use strict'
test.factory('registrationservice', function($http, $scope){
console.log('aa');
$scope.newregister = function(user, $scope) {
var newUser = new user({
username: $scope.uName,
firstname: $scope.fName,
lastname: $scope.lName,
email:$scope.mail,
password: $scope.newpwd
});
console.dir(newUser);
var $promise = $http.post('data/registration.js', newUser);
$promise.then(function(msg){
if(msg.data == 'success') console.log('success login')
else
console.log('login failed');
});
};
});
and below is the error i am getting:
Error: [$injector:unpr] http://errors.angularjs.org/1.2.7/$injector/unpr?p0=%24scopeProvider%20%3C-%20%24scope%20%3C-%20registrationservice
at Error (native)