isite
Version:
Create High Level Multi-Language Web Site [Fast and Easy]
33 lines (29 loc) • 746 B
JavaScript
app.controller('navbar', ($scope, $http) => {
$scope.register = function () {
site.showModal('#registerModal');
};
$scope.login = function () {
site.showModal('#loginModal');
};
$scope.logout = function () {
site.showModal('#logoutModal');
};
$scope.changeLang = function (language) {
if (typeof language == 'string') {
language = { id: language, dir: 'rtl', text: 'right' };
if (!language.id.like('*ar*')) {
language.dir = 'ltr';
language.text = 'left';
}
}
$http({
method: 'POST',
url: '/x-language/change',
data: language,
}).then(function (response) {
if (response.data.done) {
window.location.reload(!0);
}
});
};
});