I've started learning Angular JS ,I keep getting '$scope is not defined' console errors for this controller code in AngularJS: any idea ?
Service :signup.js
'use strict';
angular.module('crud')
.service('Signup',function () {
var data={
email:$scope.email,password:$scope.password,confirmPassword:$scope.confirmPassword
}
//console.log(data);
$sails.post("/api/user",data)
.success(function (data, status, headers, jwr) {
$scope.users=data;
//$scope.user=data;
})
.error(function (data, status, headers, jwr) {
console.log(data);
//console.log(headers);
alert('Houston, we got a problem!');
});
});
Signupcontroller.js
'use strict';
angular.module('crud')
.controller('SignupCtrl', function ($scope,Signup) {
// Using .success() and .error()
});