Skip to content

Instantly share code, notes, and snippets.

@nelsonpecora
Last active December 21, 2015 14:48
Show Gist options
  • Select an option

  • Save nelsonpecora/6322108 to your computer and use it in GitHub Desktop.

Select an option

Save nelsonpecora/6322108 to your computer and use it in GitHub Desktop.
/* controller 1 */
app.userAuth.controller('LoginFormCtrl', ['$scope', 'UserData', function($scope, UserData) {
$scope.email = UserData.email;
$scope.password = UserData.password;
$scope.login = function() {
console.log('sent login form');
}
}]);
/* controller 2. I want the emails to be two-way-bound */
.userAuth.controller('ResetFormCtrl', ['$scope', 'UserData', function($scope, UserData) {
$scope.email = UserData.email;
$scope.reset = function() {
console.log('sent reset form');
}
}]);
app.userAuth.factory('UserData', function() {
var User = {
email: null,
password: null
};
return User;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment