'use strict'; // Declare app level module which depends on views, and components var myApp = angular.module('myApp', ['ngRoute', 'gettext', 'ngCookies', 'ngMaterial']). config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) { $routeProvider. when('/', { templateUrl: 'templates/home.html' }). when('/our-services', { templateUrl: 'templates/our-services.html' }). when('/developments', { templateUrl: 'templates/developments.html' }). when('/web-sites', { templateUrl: 'templates/web-sites.html' }). when('/web-apps', { templateUrl: 'templates/web-apps.html' }). when('/mobile-apps', { templateUrl: 'templates/mobile-apps.html' }). when('/edms', { templateUrl: 'templates/edms.html' }). when('/technologies', { templateUrl: 'templates/technologies.html' }). when('/quality-policy', { templateUrl: 'templates/quality-policy.html' }). when('/about-us', { templateUrl: 'templates/about-us.html' }). otherwise({ redirectTo: '/' }); //$locationProvider.html5Mode({ // enabled: true, // requireBase: false //}); // For prerender.io //$locationProvider.hashPrefix('!'); }]); myApp.controller('mainCtrl', ['$scope', '$location', 'gettextCatalog', '$cookies', '$http', '$mdToast', '$animate', function ($scope, $location, gettextCatalog, $cookies, $http, $mdToast, $animate) { $scope.isActive = function (viewLocation) { return viewLocation === $location.path(); }; $scope.getCurrentLanguage = function () { return gettextCatalog.getCurrentLanguage(); } $scope.changeLanguage = function (lang) { $cookies.put('lang', lang); gettextCatalog.setCurrentLanguage(lang); }; init(); function init() { $scope.contactName = ''; $scope.contactEmail = ''; $scope.contactSubject = ''; $scope.contactMsg = ''; $scope.toastPosition = { bottom: false, top: true, left: false, right: true }; } $scope.getToastPosition = function () { return Object.keys($scope.toastPosition) .filter(function (pos) { return $scope.toastPosition[pos]; }) .join(' '); }; $scope.sendMail = function () { alert('Please see contacts to get in touch with us.'); return; }; }]); myApp.run(function (gettextCatalog, $cookies) { var currentLang = $cookies.get('lang'); if (currentLang) { gettextCatalog.currentLanguage = currentLang; } else { gettextCatalog.currentLanguage = "en_EN"; } //gettextCatalog.debug = true; });