pyc-website
main website for pyc inc.
git clone https://9o.is/git/pyc-website.git
Contact.js
(740B)
1 angular.module("Contact", ['Forms', 'ngAlert'])
2
3 .controller('ContactAlert', ['$scope', '$controller', function($scope, $controller) {
4 $controller('AlertCtrl', {$scope: $scope});
5
6 $scope.$on('alertContactApp', function(event, alert) {
7 $scope.addAlert(alert);
8 });
9 }])
10
11 .controller('ContactCtrl', ['$scope', '$controller', '$rootScope', function($scope, $controller, $rootScope) {
12 $controller('FormCtrl', {$scope: $scope});
13
14 $scope.save = function() {
15 var success = function(alert) {
16 $rootScope.$broadcast('alertContactApp', alert);
17 $scope.reset();
18 };
19
20 var failure = function(alert) {
21 $rootScope.$broadcast('alertContactApp', alert);
22 };
23
24 $scope.submit('Contact', 'submit', success, failure);
25 };
26 }]);