define(['app', 'lodash'], function(app, _) { 'use strict';

	return ['$location','$scope','$http','$window', function ($location,$scope,$http,$window) {

                 var _ctrl = this;
				_ctrl.goTo = goTo;
				$scope.$root.page={};
				$scope.$root.page.title = "Contact Us";

				//============================================================
				//
				//============================================================
				function goTo (url) {
						$location.path(url);
				}
				function contact() {
					$scope.doc.meta={domain:[$window.location.hostname]};
          if ($scope.contactForm.$valid)
            $http.post('/api/2017/contact-us', $scope.doc).then(function() {
              $scope.msg = 'Thank you ' + $scope.doc.firstName + ' ' + $scope.doc.lastName + ', for reaching out.  You should receive a copy of you message and a response there after.';

							delete($scope.error);
						}).catch(function(err) {


              $scope.error = err;
            });

        }
        $scope.contact = contact;
    }];
});
