(function () { "use strict"; var streamApp = angular.module('streamApp'); streamApp.directive('registerDirective', ['userService', '$routeParams', '$location', RegisterDirective]); function RegisterDirective(userService, $routeParams, $location) { return { restrict: 'E', scope: { callBack: '=' }, templateUrl: '/App/Directives/register/registerDirective.html?v=6.0.0c', link: function (scope, element, attrs, tabsCtrl) { scope.register = function () { scope.acceptTerms = true; scope.submitted = true; if (scope.name && scope.email && scope.email === scope.confirmEmail) { $('.upload').show(); userService.register(scope.email, scope.acceptTerms, scope.name).then(function () { //success report_conversion(); var last = $routeParams.start; $('.upload').hide(); if (!scope.callBack) { if (last) { $location.url(last); } else { $location.url('/'); } } else { scope.callBack(); } }).catch(response => { scope.errorMessage = response.data; $('.upload').hide(); }); } }; } }; } function report_conversion(url) { var callback = function () { if (typeof (url) != 'undefined') { window.location = url; } }; try { // google gtag('event', 'conversion', { 'send_to': 'AW-696539402/GL5ECKyq4LkBEIqykcwC', 'event_callback': callback }); // pinterest pintrk('track', 'signup'); // fb fbq('track', 'CompleteRegistration'); } catch (e) { } return false; } }());