Skip to content
InfinityKnow

InfinityKnow

Infinity Knowledge (IK) : Technology, Articles, Topics, Facts or many More.

  • Home
  • Education
    • yttags
    • Make Money
    • Jobs
    • Programming
      • Technology
      • Web Design
      • WEB HOSTING
      • Interview
  • Entertainment
    • pakainfo
    • Sports
    • Tips and Tricks
      • Law
      • Photography
      • Travel
  • Health
    • Insurance
    • Lifestyle
      • Clothing
      • Fashion
      • Food
  • News
    • Insurance
      • Auto Car Insurance
      • Business Insurance
    • Donate
    • California
  • News
    • Political
  • Home Improvement
  • Trading
    • Marketing
    • Top Tranding
    • Business
    • Real Estate
  • Full Form
  • Contact Us
  • Angular Authentication API PHP MySQLi Technology
  • goldfish ka scientific naam kya hai
    Goldfish ka Scientific Naam Kya hai? ( गोल्डफिश का साइंटिफिक नाम क्या है? ) – [2nd October 2021] Top Tranding
  • i love you shayari Shayari
  • Love Shayari New Romantic Shayari 2019 – Best Attitude Shayari in Hindi
    Love Shayari New Romantic Shayari 2019 – Best Attitude Shayari in Hindi Entertainment
  • Angularjs MD5 Login and registration with php
    Angularjs MD5 Login and registration with php Technology
  • Angular Interval Service Example Technology
  • Simple Angular Tabs Controls Directive Technology
  • C# Boxing & Unboxing Tutorial with Examples Technology

Angular Keep session alive Timeout management

Posted on July 16, 2018 By admin No Comments on Angular Keep session alive Timeout management

Angular Keep session alive Timeout management

Today, We want to share with you Angular Keep session alive Timeout management.
In this post we will show you keep session alive timeout in angularjs example, hear for Handling session timeout in Angular we will give you demo and example for implement.
In this post, we will learn about Angular session timeout and management with an example.

Welcome to the In infinityknow.com website! You will Step By Step learn web programming, easy and very fun. This website allmost provides you with a complete web programming tutorial presented in an easy-to-follow manner. Each web programming tutorial has all the practical examples with web programming script and screenshots available.keep session alive timeout in angularjs example

Generally, I want to learn and teach a good practice for this implementation(keep alive with secure) in my angularjs (application) web application.
here, I want to be able to display some greeting required login and logout button (means exit) for logged users in page,
even after the refresh(load ctrl + f5) the whole page details until they user logout or close the browser(mozila,chrome.etc..) and exit.
And to show in a page a “Sign in/Sign up” (login or registration form) button if the user login is not (login)authenticated yet.
so I need to use the same logic(logically) with some state is “private” states of my web application,

READ :  Last Inserted Id Using Laravel Eloquent Examples

Keep session alive after a page refresh in AngularJS

for example:
if any user is not logged check and he accesses this url(route) account/options or any page route then he is forced (access data information) to log in in order to proceed and display info.

keep alive timeout – angularjs ng-idle example

app.js

[php]

‘use strict’;

//define custome parm
angular
.module(‘saleswebapp’, [
‘ngCookies’,
‘ngResource’,
‘ui.router’,
])
.run(
[ ‘$rootScope’, ‘$state’, ‘$stateParams’,
function ($rootScope, $state, $stateParams) {
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
}
]
)
.config([‘$stateProvider’, function ($stateProvider) {

/*
now check authenticated or not in angularJS
*/

$stateProvider
.state(‘iniciodata’, {
url: ‘/’,
templateUrl: ‘views/page_main.html’,
controller: ‘SimpleMainCtrl’,
})
.state(‘paneldata’, {
url: ‘/panelpage’,
title: ‘angularjs session data get -‘,
templateUrl: ‘views/page_panel.html’,
controller: ‘SalesPanelCtrl’
})
.state(‘logindata’, {
url: ‘/loginpage’,
title: ‘keep angularjs session login page -‘,
templateUrl: ‘views/page_login.html’,
controller: ‘SimpleLoginCtrl’
});
}]);

READ :  Angularjs Remove Table Row with Apply ngClassEven NgClassOdd

[/php]

File name : Auth.js

[php]
‘use strict’;

angular.module(‘saleswebapp’)
.service(‘Auth’, function($http) {
return {
// call function
isLogged: function(cookieORsomethingElse){
//check condition some magic sessionAlive true or false
if (sessionAlive) {
//session active
return true;
} else {
//destroy Cookie here
destroyOldCookieIfPresent();
return false;
}
},
login: function(credencial_data) {
//send request with authenticated
return $http.post(‘http://api.infinityknow.com?index.php/login/’, credencial_data);
},
logout: function() {
//api call logout request
},
registro: function() {
//api call regeter information send request server side
}
};
});

[php]

file Name : Login.js

[php]

‘use strict’;

angular.module(‘saleswebapp’)
.controller(‘SimpleLoginCtrl’, function ($scope, Auth, $rootScope, $state) {

$scope.credencial = {sales_servidor: ‘infinityknow’};

$scope.login = function() {
Auth.login({
s_user_id: $scope.credencial.sales_username,
s_password: $scope.credencial.sales_password,
s_server: $scope.credencial.sales_servidor
}).success(function(data, status) {
//retrive data information
console.log(data, status);
$state.go(‘paneldata’);
}).error(function() {
//generate error log
console.log(‘error: you suck’);
});
};
});
[/php]

READ :  How to create database seeder in laravel 6?

Related posts:

  1. Angular Session localStorage and sessionStorage
  2. Angularjs Session Management with Login Authentication using PHP
  3. Vuejs Simple Navigation Menu vue router-link params
  4. AngularJS Session Storage ngStorage
Technology, AngularJs

Post navigation

Previous Post: Angular GridView Insert Update and Delete in ASP.NET MVC
Next Post: Angular Sum all properties value in JSON object

Related Posts

  • Laravel 6 get current login user details using Auth Technology
  • social media
    How social is Indian Social Media?  Technology
  • jQuery Display Image preview before upload in Asp.net Technology
  • PHP classes constructor Example
    PHP classes constructor and destructor Example Technology
  • Angular Multi Select Drop Down Options Technology
  • Angular Arithmetic Operations BODMAS Rule Technology

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Account web hosting (1)
  • AngularJs (277)
  • Articles (143)
  • Asp.Net (49)
  • Astrology (2)
  • Attorney (7)
  • Auto Car Insurance (4)
  • Biography (2)
  • Business (9)
  • Business Insurance (3)
  • California (4)
  • Choose the web hosting (1)
  • Clothing (6)
  • cloud (8)
  • Cloud data storage (2)
  • Credit (1)
  • Dedicated hosting server web (1)
  • Dedicated server web hosting (1)
  • Dedicated web hosting (1)
  • Degree (11)
  • Design (9)
  • Differences shared hosting (1)
  • Donate (2)
  • Education (37)
  • Energy web hosting (1)
  • Entertainment (6)
  • Facts (12)
  • Fashion (3)
  • Finance (3)
  • Food (5)
  • full form (90)
  • Google Adsense (22)
  • Health (21)
  • Home Improvement (5)
  • Insurance (7)
  • Interview (2)
  • Jobs (6)
  • jquery (2)
  • jQuery (2)
  • Laravel (164)
  • Lawyer (4)
  • Lifestyle (6)
  • Loans (6)
  • Make Money (31)
  • Managed dedicated server (1)
  • Managed hosting solution (1)
  • Managed servers (1)
  • Marketing (8)
  • Mortgage (2)
  • Movies (21)
  • MySQL (180)
  • News (5)
  • Photography (1)
  • PHP (250)
  • Programming (18)
  • Quotes (75)
  • Real Estate (2)
  • SEO (9)
  • Shared web hosting (1)
  • Shayari (67)
  • Sports (5)
  • Status (34)
  • Stories (45)
  • suvichar (8)
  • Tech (3)
  • Technology (675)
  • Tips and Tricks (43)
  • Top Tranding (36)
  • Trading (28)
  • Travel (12)
  • Uncategorized (8)
  • VueJs (179)
  • Web Design (2)
  • WEB HOSTING (1)
  • Web hosting company (1)
  • Web hosting really (1)
  • Web hosting windows (1)
  • Which website hosting (1)
  • Wishes (13)
  • wordpress (15)

Categories

AngularJs (277) Articles (143) Asp.Net (49) Attorney (7) Business (9) Clothing (6) cloud (8) Degree (11) Design (9) Education (37) Entertainment (6) Facts (12) Food (5) full form (90) Google Adsense (22) Health (21) Home Improvement (5) Insurance (7) Jobs (6) Laravel (164) Lifestyle (6) Loans (6) Make Money (31) Marketing (8) Movies (21) MySQL (180) News (5) PHP (250) Programming (18) Quotes (75) SEO (9) Shayari (67) Sports (5) Status (34) Stories (45) suvichar (8) Technology (675) Tips and Tricks (43) Top Tranding (36) Trading (28) Travel (12) Uncategorized (8) VueJs (179) Wishes (13) wordpress (15)
  • Nag Tibba
    Points to Remember During the Nag Tibba Trek Travel
  • Leaflet Distribution Services: Why Birmingham Businesses Need to Hire Them Trading
  • Kuttymovies
    Kuttymovies 2021 – Latest Tamil Movies Collection Download Movies
  • Janmashtami Vrat
    janmashtami vrat – 2021 Quotes
  • Happy Krishna Janmashtami
    happy krishna janmashtami Quotes
  • Get Url Parameter with Query String using angularjs
    Get Url Parameter with Query String using angularjs Technology
  • Insurance Firms Marketing Ideas, Tips and strategies
    Insurance Firms Marketing Ideas, Tips and strategies Insurance
  • How to Open URL in New Tab using Angular Technology

Copyright © 2022 InfinityKnow.

Powered by PressBook News WordPress theme