JavaScript I want to get previous path on a button click event in angular.js

Get previous location path on back button click event using by angular.js


What I want?

I want to go previous page when i click the back button in my current page.

HTML

<input type="button" ng-click="back()" />

Controller

$scope.back=function()
{
// here i want to get the previous path(or url) 
}


What I did

I can get the prev url by using on $locationChangeStart and $locationChangeSuccess

 $scope.$on('$locationChangeStart', function (evt, absNewUrl, absOldUrl) {
        var old = absOldUrl
    });

I don't want this way, i want to get the previous URL on button click event.

Answer:1

Try this:

function back() {
    parent.history.back();
}
Answer:2

I am trying to send a json to a php script on a server and even though I have included header in php script to have CORS the console throws error error message XMLHttpRequest cannot load http://...

I am trying to send a json to a php script on a server and even though I have included header in php script to have CORS the console throws error error message XMLHttpRequest cannot load http://...

  1. cors not working with https
  2. cors not working with localhost
  3. cors not working with postman
  4. cors not working with windows authentication
  5. cors not working with spring security

I am new to ExtJs. I have created a twitter widget on twitter. It just works fine on simple html page. As twitter says you just need to include <a class="twitter-timeline" href="https://twitter....

I am new to ExtJs. I have created a twitter widget on twitter. It just works fine on simple html page. As twitter says you just need to include <a class="twitter-timeline" href="https://twitter....

  1. embed twitter widget into website

How do I parse this to int? "'10'" Thanks.

How do I parse this to int? "'10'" Thanks.

  1. convert double quotes to html
  2. convert double quotes to ascii
  3. convert double quotes javascript
  4. vscode convert double quotes to single
  5. php convert double quotes to single
  6. json convert double quotes
  7. php convert double quotes
  8. python convert double quotes
  9. java convert double quotes
  10. bash convert double quote

I'm using phantomjs for taking screenshots of several webpages. To get a screenshot image i have used the following code. var page = require('webpage').create(); page.viewportSize = { width: 1200,...

I'm using phantomjs for taking screenshots of several webpages. To get a screenshot image i have used the following code. var page = require('webpage').create(); page.viewportSize = { width: 1200,...