Search Posts

Category: browser-history

Detect hit to back history in angular

how to Detect hit to back history in angular I did this below to detect back button hit to previous page, but the detection is working fine, my headache is that the app run functions variable $rootScope.$rootScope.UseInController don’t pass the data once to controller. Here is the script.$rootScope, $location, $route){ $rootScope.$on(‘$locationChangeSuccess’, function() { $rootScope.actualLocation = $location.path(); }); $rootScope.$watch( function() { return $location.path(); }, function(newLocation, oldLocation){ if($rootScope.actualLocation === newLocation) { alert(‘You go back to previous […]

Browser back button angular ui router

I want to get working back button of the browser with angular 1.4.10 ui-router. This is sample code of my app.js var myApp = angular.module(“myApp”,[ “ui.router”, “AppCtrls”]); myApp.config(function ($stateProvider, $urlRouterProvider, $locationProvider){ $locationProvider.html5Mode({ enabled: true, requireBase: false }); $stateProvider.state(“state1”, { url: “”, template: “<p>State 1</p>”, controller: “Ctrl1” }).state(“state2”, { url: “”, template: “<p>State 2</p>”, controller: “Ctrl2” }); }); var ctrls = angular.module(“AppCtrls”, []); ctrls.controller( “Ctrl1”, function($scope) { console.log(“Ctrl1 loaded.”); }); ctrls.controller( “Ctrl2”, function($scope) { console.log(“Ctrl2 loaded.”); […]

Angularjs after using ‘location replace’, duplicated pages remained

In my code, logics are executed like belows. Showing items list in main page. Click one item and move to detail page. I wanna change something, so click edit button and move to edit page Edit some and finish editing with click the confirm button. When click the button, execute $state.go(toGo, params, {location: ‘replace’}); Then move to detail page. Through these, location history has successive detail page How can I remove this successive pages in […]

Angularjs how to get browser history list?

I want to remove my history, so I use this code $state.go(toGo, params, {location: ‘replace’}) When I use this, I could remove the very last history. And my question is, how to remove history before the last removed page. For example, to see the content of an item, I move into detailPage Click edit Button to edit this item, and move into editPage. After I finish editing this, press finish Button, and move into detailPage […]